summaryrefslogtreecommitdiffstats
path: root/tools/runonphone
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-11-05 13:27:48 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-11-05 13:33:31 (GMT)
commit763f3acd879648648465475aef773fe0876934a9 (patch)
treed518b86cdd5c32fc7ab415bd0c862df61f4dd138 /tools/runonphone
parent0d6991e3219de48429109dc272e9598acf45d5df (diff)
downloadQt-763f3acd879648648465475aef773fe0876934a9.zip
Qt-763f3acd879648648465475aef773fe0876934a9.tar.gz
Qt-763f3acd879648648465475aef773fe0876934a9.tar.bz2
Prevent multiple modprobe messages for the same phone
Cleaned up some unnecessary code in the serenum_unix file. Add the device only once to the list used for printing info about devices with no serial drivers. Add each ACM interface ID, trusting the numbers given in the master interface. The existing code of searching for the slave interface would have been appropriate for a user-mode device driver, but we only need the interface numbers as we are going to use existing device drivers via the tty devices Reviewed-By: axis
Diffstat (limited to 'tools/runonphone')
-rw-r--r--tools/runonphone/serenum_unix.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp
index 4491bd0..f5b2521 100644
--- a/tools/runonphone/serenum_unix.cpp
+++ b/tools/runonphone/serenum_unix.cpp
@@ -146,32 +146,17 @@ QList<SerialPortId> enumerateSerialPorts(int loglevel)
// second loop to find the actual data interface.
foreach (int i, usableInterfaces) {
- for (int m = 0; m < usbConfig.bNumInterfaces; ++m) {
- for (int o = 0; o < usbConfig.interface[m].num_altsetting; ++o) {
- struct usb_interface_descriptor &descriptor = usbConfig.interface[m].altsetting[o];
- if (descriptor.bInterfaceNumber != i)
- continue;
- if (descriptor.bInterfaceClass == 10) { // "CDC Data"
- if (loglevel > 1) {
- qDebug() << " found the data port"
- << "bus:" << bus->dirname
- << "device" << device->filename
- << "interface" << descriptor.bInterfaceNumber;
- }
- // ### manufacturer and product strings are only readable as root :(
- if (!manufacturerString.isEmpty() && !productString.isEmpty()) {
- eligibleInterfaces << QString("usb-%1_%2-if%3")
- .arg(manufacturerString.replace(QChar(' '), QChar('_')))
- .arg(productString.replace(QChar(' '), QChar('_')))
- .arg(i, 2, 16, QChar('0'));
- } else {
- eligibleInterfaces << QString("if%1").arg(i, 2, 16, QChar('0')); // fix!
- }
- eligibleInterfacesInfo << InterfaceInfo(manufacturerString, productString, device->descriptor.idVendor, device->descriptor.idProduct);
- }
- }
+ // ### manufacturer and product strings are only readable as root :(
+ if (!manufacturerString.isEmpty() && !productString.isEmpty()) {
+ eligibleInterfaces << QString("usb-%1_%2-if%3")
+ .arg(manufacturerString.replace(QChar(' '), QChar('_')))
+ .arg(productString.replace(QChar(' '), QChar('_')))
+ .arg(i, 2, 16, QChar('0'));
+ } else {
+ eligibleInterfaces << QString("if%1").arg(i, 2, 16, QChar('0')); // fix!
}
}
+ eligibleInterfacesInfo << InterfaceInfo(manufacturerString, productString, device->descriptor.idVendor, device->descriptor.idProduct);
}
}
}