diff options
author | BogDan Vatra <bogdan@kde.org> | 2013-10-22 13:51:17 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kde.org> | 2013-10-22 13:05:08 +0200 |
commit | d8aadac3231d7d8265ffc6d9a5223286fb136c74 (patch) | |
tree | 5884f1f2e8d6ce85cc03dfc2b615a3287289a2e4 | |
parent | bdf8655376a9a7fd513140f5adf1147ccff3e98d (diff) | |
download | qt-creator-d8aadac3231d7d8265ffc6d9a5223286fb136c74.tar.gz |
Remove adb daemon logs
If adb daemon is not started, adb devices command will add two lines to
the output, messing up the devices list.
Change-Id: I40dcf586d2661df2de0a56aaac543c3b4739ab0d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r-- | src/plugins/android/androidconfigurations.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 543c66ab26..5524043b62 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -457,7 +457,12 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro return devices; } QList<QByteArray> adbDevs = adbProc.readAll().trimmed().split('\n'); - adbDevs.removeFirst(); + if (adbDevs.empty()) + return devices; + + while (adbDevs.first().startsWith("* daemon")) + adbDevs.removeFirst(); // remove the daemon logs + adbDevs.removeFirst(); // remove "List of devices attached" header line // workaround for '????????????' serial numbers: // can use "adb -d" when only one usb device attached @@ -578,7 +583,13 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const return devices; } QList<QByteArray> avds = proc.readAll().trimmed().split('\n'); - avds.removeFirst(); + if (avds.empty()) + return devices; + + while (avds.first().startsWith("* daemon")) + avds.removeFirst(); // remove the daemon logs + avds.removeFirst(); // remove "List of devices attached" header line + AndroidDeviceInfo dev; for (int i = 0; i < avds.size(); i++) { QString line = QLatin1String(avds[i]); |