mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-14 08:16:03 +02:00
Improved detection of device model.
This commit is contained in:
parent
cc2868a6f4
commit
9e8e389e99
1 changed files with 16 additions and 3 deletions
|
@ -98,6 +98,8 @@ void TestRunnerMobile::connectDevice() {
|
|||
QString line2 = devicesFile.readLine();
|
||||
|
||||
const QString DEVICE{ "device" };
|
||||
const QString MODEL{ "model" };
|
||||
|
||||
if (line2.contains("unauthorized")) {
|
||||
QMessageBox::critical(0, "Unauthorized device detected", "Please allow USB debugging on device");
|
||||
} else if (line2.contains(DEVICE)) {
|
||||
|
@ -110,10 +112,21 @@ void TestRunnerMobile::connectDevice() {
|
|||
QStringList tokens = line2.split(QRegExp("[\r\n\t ]+"));
|
||||
QString deviceID = tokens[0];
|
||||
|
||||
QString modelID = tokens[3].split(':')[1];
|
||||
// Find the model entry
|
||||
int i;
|
||||
for (i = 0; i < tokens.size(); ++i) {
|
||||
if (tokens[i].contains(MODEL)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_modelName = "UNKNOWN";
|
||||
if (modelNames.count(modelID) == 1) {
|
||||
_modelName = modelNames[modelID];
|
||||
if (i < tokens.size()) {
|
||||
QString modelID = tokens[i].split(':')[1];
|
||||
|
||||
if (modelNames.count(modelID) == 1) {
|
||||
_modelName = modelNames[modelID];
|
||||
}
|
||||
}
|
||||
|
||||
_detectedDeviceLabel->setText(_modelName + " [" + deviceID + "]");
|
||||
|
|
Loading…
Reference in a new issue