From c74b93df047157a6ff8ca3ffa2dd2f624760824f Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 24 Jun 2011 14:00:17 +0100 Subject: 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 --- tools/runonphone/serenum_unix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 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 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 } } } -- cgit v0.12