summaryrefslogtreecommitdiffstats
path: root/tools/runonphone
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2011-06-24 13:00:17 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-06-24 13:00:17 (GMT)
commitc74b93df047157a6ff8ca3ffa2dd2f624760824f (patch)
treeb47ab17a308cc987413243dd65d18e2164867cbb /tools/runonphone
parentaa6bd900970b55684db38107a903677afaf26a25 (diff)
downloadQt-c74b93df047157a6ff8ca3ffa2dd2f624760824f.zip
Qt-c74b93df047157a6ff8ca3ffa2dd2f624760824f.tar.gz
Qt-c74b93df047157a6ff8ca3ffa2dd2f624760824f.tar.bz2
runonphone: Fix usb device enumeration on Mac OS X
The change in 763f3acd879648648465475aef773fe0876934a9, when merged in a315c693d0f3dd64711b8459d86b89ddc48e8c1a, broke the usb device enumeration on OS X. This commit makes it work again, but now we look for two /dev entries per device (although only one of them exists). If many usb devices are connected, this increases the risk for false matches - if that ever happens, the iteration/checking that was removed in 763f3acd879648648465475aef773fe0876934a9 could be readded within the #ifdef Q_OS_MAC, making it add only one regexp per device again. Merge-request: 2633 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tools/runonphone')
-rw-r--r--tools/runonphone/serenum_unix.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp
index dc9e1d6..d0e7665 100644
--- a/tools/runonphone/serenum_unix.cpp
+++ b/tools/runonphone/serenum_unix.cpp
@@ -148,7 +148,8 @@ QList<SerialPortId> enumerateSerialPorts(int loglevel)
foreach (int i, usableInterfaces) {
#ifdef Q_OS_MAC
eligibleInterfaces << QString("^cu\\.usbmodem.*%1$")
- .arg(QString("%1").arg(descriptor.bInterfaceNumber, 1, 16).toUpper());
+ .arg(QString("%1").arg(i, 1, 16).toUpper());
+ eligibleInterfacesInfo << InterfaceInfo(manufacturerString, productString, device->descriptor.idVendor, device->descriptor.idProduct);
#else
// ### manufacturer and product strings are only readable as root :(
if (!manufacturerString.isEmpty() && !productString.isEmpty()) {
@@ -161,7 +162,11 @@ QList<SerialPortId> enumerateSerialPorts(int loglevel)
}
#endif
}
+#ifndef Q_OS_MAC
+ // On mac, we need a 1-1 mapping between eligibleInterfaces and eligibleInterfacesInfo
+ // in order to find the friendly name for an interface
eligibleInterfacesInfo << InterfaceInfo(manufacturerString, productString, device->descriptor.idVendor, device->descriptor.idProduct);
+#endif
}
}
}