summaryrefslogtreecommitdiffstats
path: root/tools/runonphone/main.cpp
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-03-18 15:40:30 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-03-19 08:44:29 (GMT)
commita34c82bb5a0a0e6c2bdccfef5fb31e7a0667c906 (patch)
tree79e762de08576ecf108db1c4da3a879366ceddb1 /tools/runonphone/main.cpp
parentd758a688f037d8d369e4150dda322736ce6b5346 (diff)
downloadQt-a34c82bb5a0a0e6c2bdccfef5fb31e7a0667c906.zip
Qt-a34c82bb5a0a0e6c2bdccfef5fb31e7a0667c906.tar.gz
Qt-a34c82bb5a0a0e6c2bdccfef5fb31e7a0667c906.tar.bz2
Use libusb to auto-detect the port to use to communicate with the phone
Diffstat (limited to 'tools/runonphone/main.cpp')
-rw-r--r--tools/runonphone/main.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index 65085e0..af08777 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -136,22 +136,22 @@ int main(int argc, char *argv[])
if (serialPortName.isEmpty()) {
if (loglevel > 0)
outstream << "Detecting serial ports" << endl;
- QList <SerialPortId> ports = enumerateSerialPorts();
- foreach(SerialPortId id, ports) {
+ foreach (const SerialPortId &id, enumerateSerialPorts()) {
if (loglevel > 0)
outstream << "Port Name: " << id.portName << ", "
<< "Friendly Name:" << id.friendlyName << endl;
- if (serialPortName.isEmpty()) {
- if (!id.friendlyName.isEmpty()
- && serialPortFriendlyName.isEmpty()
- && (id.friendlyName.contains("symbian", Qt::CaseInsensitive)
- || id.friendlyName.contains("s60", Qt::CaseInsensitive)
- || id.friendlyName.contains("nokia", Qt::CaseInsensitive)))
- serialPortName = id.portName;
- else if (!id.friendlyName.isEmpty()
- && !serialPortFriendlyName.isEmpty()
- && id.friendlyName.contains(serialPortFriendlyName))
- serialPortName = id.portName;
+ if (!id.friendlyName.isEmpty()
+ && serialPortFriendlyName.isEmpty()
+ && (id.friendlyName.contains("symbian", Qt::CaseInsensitive)
+ || id.friendlyName.contains("s60", Qt::CaseInsensitive)
+ || id.friendlyName.contains("nokia", Qt::CaseInsensitive))) {
+ serialPortName = id.portName;
+ break;
+ } else if (!id.friendlyName.isEmpty()
+ && !serialPortFriendlyName.isEmpty()
+ && id.friendlyName.contains(serialPortFriendlyName)) {
+ serialPortName = id.portName;
+ break;
}
}
if (serialPortName.isEmpty()) {