diff options
author | Chris Liechti <cliechti@gmx.net> | 2016-05-12 23:48:01 +0200 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2016-05-12 23:48:01 +0200 |
commit | c0d6a0f88a800c54c908ec4e94af2a332384e90b (patch) | |
tree | c6dadfe8734031b7fcefd968a74b403a4031ab7f | |
parent | f41b45939754689e5414d0e319664f2b19cb1559 (diff) | |
download | pyserial-git-c0d6a0f88a800c54c908ec4e94af2a332384e90b.tar.gz |
win32: fix error code checking in _cancel_overlapped_io
it may also report ERROR_IO_INCOMPLETE when io is in progress
-rw-r--r-- | serial/serialwin32.py | 2 | ||||
-rw-r--r-- | serial/win32.py | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/serial/serialwin32.py b/serial/serialwin32.py index b843ac7..d11a2c4 100644 --- a/serial/serialwin32.py +++ b/serial/serialwin32.py @@ -437,7 +437,7 @@ class Serial(SerialBase): ctypes.byref(overlapped), ctypes.byref(rc), False) - if not err and win32.GetLastError() == win32.ERROR_IO_PENDING: + if not err and win32.GetLastError() in (win32.ERROR_IO_PENDING, win32.ERROR_IO_INCOMPLETE): # cancel, ignoring any errors (e.g. it may just have finished on its own) win32.CancelIoEx(self._port_handle, overlapped) diff --git a/serial/win32.py b/serial/win32.py index cef5568..2fddf6b 100644 --- a/serial/win32.py +++ b/serial/win32.py @@ -219,6 +219,7 @@ EV_DSR = 16 # Variable c_int MAXDWORD = 4294967295 # Variable c_uint EV_RLSD = 32 # Variable c_int ERROR_SUCCESS = 0 +ERROR_IO_INCOMPLETE = 996 ERROR_IO_PENDING = 997 # Variable c_long MS_CTS_ON = 16 # Variable c_ulong EV_EVENT1 = 2048 # Variable c_int |