mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:29:13 +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();
|
QString line2 = devicesFile.readLine();
|
||||||
|
|
||||||
const QString DEVICE{ "device" };
|
const QString DEVICE{ "device" };
|
||||||
|
const QString MODEL{ "model" };
|
||||||
|
|
||||||
if (line2.contains("unauthorized")) {
|
if (line2.contains("unauthorized")) {
|
||||||
QMessageBox::critical(0, "Unauthorized device detected", "Please allow USB debugging on device");
|
QMessageBox::critical(0, "Unauthorized device detected", "Please allow USB debugging on device");
|
||||||
} else if (line2.contains(DEVICE)) {
|
} else if (line2.contains(DEVICE)) {
|
||||||
|
@ -110,10 +112,21 @@ void TestRunnerMobile::connectDevice() {
|
||||||
QStringList tokens = line2.split(QRegExp("[\r\n\t ]+"));
|
QStringList tokens = line2.split(QRegExp("[\r\n\t ]+"));
|
||||||
QString deviceID = tokens[0];
|
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";
|
_modelName = "UNKNOWN";
|
||||||
if (modelNames.count(modelID) == 1) {
|
if (i < tokens.size()) {
|
||||||
_modelName = modelNames[modelID];
|
QString modelID = tokens[i].split(':')[1];
|
||||||
|
|
||||||
|
if (modelNames.count(modelID) == 1) {
|
||||||
|
_modelName = modelNames[modelID];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_detectedDeviceLabel->setText(_modelName + " [" + deviceID + "]");
|
_detectedDeviceLabel->setText(_modelName + " [" + deviceID + "]");
|
||||||
|
|
Loading…
Reference in a new issue