diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-07-26 21:52:36 +0200 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-07-26 21:52:36 +0200 |
commit | 267c9c0da02de8ab4e7c7510b5c9f1ceb13cbae4 (patch) | |
tree | 4f17c2a258795eef32f439a5ac6e3890abe70735 | |
parent | 51773f349891c922cb5401637e01336a42edecc4 (diff) | |
parent | 84df6ec29db5981d30d1149a8b4a091ecc7c5dce (diff) | |
download | qtserialport-267c9c0da02de8ab4e7c7510b5c9f1ceb13cbae4.tar.gz |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: Icf3f1dd9f471f33d129a74053c0599c6013170d7
-rw-r--r-- | dist/changes-5.1.1 | 25 | ||||
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_unix.cpp | 1 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 37 |
5 files changed, 60 insertions, 15 deletions
diff --git a/dist/changes-5.1.1 b/dist/changes-5.1.1 new file mode 100644 index 0000000..e233af4 --- /dev/null +++ b/dist/changes-5.1.1 @@ -0,0 +1,25 @@ +Qt 5.1.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.1.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.1/ + +The Qt version 5.1 series is binary compatible with the 5.0.x series. +Applications compiled for 5.0 will continue to run with 5.1. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + +**************************************************************************** +* General * +**************************************************************************** + + - This release contains only minor code improvements. diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 2f6c8cc..92d9f2f 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -429,7 +429,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) bool timedOut = false; if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(), timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } @@ -460,7 +461,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) bool timedOut = false; if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(), timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index e1e9152..8717f2d 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -479,7 +479,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) { // This is occur timeout or another error - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } @@ -514,7 +515,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) AbstractOverlappedEventNotifier *n = 0; if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp index 1d56f4e..fec1b4a 100644 --- a/src/serialport/qserialportinfo_unix.cpp +++ b/src/serialport/qserialportinfo_unix.cpp @@ -77,6 +77,7 @@ static inline const QStringList& filtersOfDevices() << QLatin1String("ttyACM*") // CDC_ACM converters (i.e. Mobile Phones). << QLatin1String("ttyGS*") // Gadget serial device (i.e. Mobile Phones with gadget serial driver). << QLatin1String("ttyMI*") // MOXA pci/serial converters. + << QLatin1String("ttymxc*") // Motorola IMX serial ports (i.e. Freescale i.MX). << QLatin1String("ttyAMA*") // AMBA serial device for embedded platform on ARM (i.e. Raspberry Pi). << QLatin1String("rfcomm*") // Bluetooth serial device. << QLatin1String("ircomm*"); // IrDA serial device. diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 7ca1f5e..b1ab76b 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -142,9 +142,12 @@ static QString devicePortName(HDEVINFO deviceInfoSet, PSP_DEVINFO_DATA deviceInf QList<QSerialPortInfo> QSerialPortInfo::availablePorts() { - static const QString vendorIdentifierPrefix(QLatin1String("VID_")); + static const QString usbVendorIdentifierPrefix(QLatin1String("VID_")); + static const QString usbProductIdentifierPrefix(QLatin1String("PID_")); + static const QString pciVendorIdentifierPrefix(QLatin1String("VEN_")); + static const QString pciDeviceIdentifierPrefix(QLatin1String("DEV_")); + static const int vendorIdentifierSize = 4; - static const QString productIdentifierPrefix(QLatin1String("PID_")); static const int productIdentifierSize = 4; QList<QSerialPortInfo> serialPortInfoList; @@ -176,15 +179,27 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() s = deviceRegistryProperty(deviceInfoSet, &deviceInfoData, SPDRP_HARDWAREID).toStringList().first().toUpper(); - int index = s.indexOf(vendorIdentifierPrefix); - if (index != -1) - serialPortInfo.d_ptr->vendorIdentifier = s.mid(index + vendorIdentifierPrefix.size(), vendorIdentifierSize) - .toInt(&serialPortInfo.d_ptr->hasVendorIdentifier, 16); - - index = s.indexOf(productIdentifierPrefix); - if (index != -1) - serialPortInfo.d_ptr->productIdentifier = s.mid(index + productIdentifierPrefix.size(), productIdentifierSize) - .toInt(&serialPortInfo.d_ptr->hasProductIdentifier, 16); + int index = s.indexOf(usbVendorIdentifierPrefix); + if (index != -1) { + serialPortInfo.d_ptr->vendorIdentifier = s.mid(index + usbVendorIdentifierPrefix.size(), vendorIdentifierSize) + .toInt(&serialPortInfo.d_ptr->hasVendorIdentifier, 16); + } else { + index = s.indexOf(pciVendorIdentifierPrefix); + if (index != -1) + serialPortInfo.d_ptr->vendorIdentifier = s.mid(index + pciVendorIdentifierPrefix.size(), vendorIdentifierSize) + .toInt(&serialPortInfo.d_ptr->hasVendorIdentifier, 16); + } + + index = s.indexOf(usbProductIdentifierPrefix); + if (index != -1) { + serialPortInfo.d_ptr->productIdentifier = s.mid(index + usbProductIdentifierPrefix.size(), productIdentifierSize) + .toInt(&serialPortInfo.d_ptr->hasProductIdentifier, 16); + } else { + index = s.indexOf(pciDeviceIdentifierPrefix); + if (index != -1) + serialPortInfo.d_ptr->productIdentifier = s.mid(index + pciDeviceIdentifierPrefix.size(), productIdentifierSize) + .toInt(&serialPortInfo.d_ptr->hasProductIdentifier, 16); + } serialPortInfoList.append(serialPortInfo); } |