summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2013-03-19 22:24:28 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-23 18:37:11 +0100
commit89acd52d6daea28415dfc313c0c25706ae356f29 (patch)
treecb95c352fb5c172b5cc9509afcaf5cb68487e3d0
parent13cf73fd7ac96fafc6752a5c18467ba7e6ce070e (diff)
downloadqtserialport-89acd52d6daea28415dfc313c0c25706ae356f29.tar.gz
Windows: Add missed error code ResourceError processing
Previously, when pulled from the system the USB Bluetooth dongle (which is associated with the opened serial port) don't cause emitting of signal error() with code ResourceError. This reproduced only in case if through already open the serial port was called the read operation, in this case read operation returns fail with the system error code ERROR_DEVICE_REMOVED. Now, this problem has been fixed and handled correctly by at least on Windows XP, Vista, 7 and 8 (x32) with the Standard MS Bluetooth stack. Seems, that it is common behavior for all the USB Bluetooth devices with use the Standard MS Bluetooth Stack. Change-Id: Ic19c850360d27a2729f72b438e1e185db09eeb97 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
-rw-r--r--src/serialport/qserialport_win.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 5747b26..07cec11 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -648,7 +648,8 @@ bool QSerialPortPrivate::startAsyncRead()
QSerialPort::SerialPortError error = decodeSystemError();
if (error != QSerialPort::NoError) {
- error = QSerialPort::ReadError;
+ if (error != QSerialPort::ResourceError)
+ error = QSerialPort::ReadError;
q_ptr->setError(error);
return false;
}
@@ -925,6 +926,9 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError() const
case ERROR_BAD_COMMAND:
error = QSerialPort::ResourceError;
break;
+ case ERROR_DEVICE_REMOVED:
+ error = QSerialPort::ResourceError;
+ break;
default:
error = QSerialPort::UnknownError;
break;