diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2014-06-07 15:18:15 +0400 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2014-06-29 19:47:53 +0200 |
commit | aee836176ff4bf60f6823a9defccee7f49b92a5b (patch) | |
tree | cfa98c10870b0ccaaa4589ca072b905ef9c24bd5 /examples | |
parent | 38f564f7255330710defcf839f4cd04e1ccfc417 (diff) | |
download | qtserialport-aee836176ff4bf60f6823a9defccee7f49b92a5b.tar.gz |
Improve the ResourceError handling on Windows
To the ResourceError handling we generally relied on triggering of the
_q_completeAsyncCommunication(), in case of ejection of an USB device
from a host. But it worked with not all USB devices (for example it did
not work with the ZTE modems). Even when this worked (for example with
the PL2303 devices), then we got the non informative "Unknown error" of
the ResourceError string representation.
It is more reasonable not to do any custom checks of an event mask when
triggered of the _q_completeAsyncCommunication() method. We need allow
to detect an errors with means of the
ReadFile/GetOverlappedResult/WaitCommEvent syscalls on an invalid device
handle.
An important note is that returns the different error codes for a
different types of devices.
For example:
* For the USB ZTE and the Samsung Android USB modem returns the
ERROR_ACCESS_DENIED error code.
* For the FTDI and the Samsung Android Diagnostic Serial Port returns
the ERROR_OPERATION_ABORTED error code.
* For the USB PL2303 device returns the ERROR_BAD_COMMAND error code.
Thus, there is no universal solution of this issue. Each vendor of the
driver implements it own way. Therefore for each new type of the device
it is necessary to add processing its error code, if we have no it yet.
Tested on Windows 7/8 with the USB ZTE and the Android modems, with the
USB PL2303 and the FTDI devices and with the Android diagnostic serial
port using Qt4 and then Qt5, no regressions found.
Task-number: QTBUG-32020
Change-Id: I61c02078ee98221ecef18a27cde3d9bae3674d70
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions