From 89acd52d6daea28415dfc313c0c25706ae356f29 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 19 Mar 2013 22:24:28 +0400 Subject: 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 Reviewed-by: Laszlo Papp --- src/serialport/qserialport_win.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1