diff options
-rw-r--r-- | serial/urlhandler/protocol_socket.py | 3 | ||||
-rw-r--r-- | serial/win32.py | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/serial/urlhandler/protocol_socket.py b/serial/urlhandler/protocol_socket.py index 36cdf1f..11f6a05 100644 --- a/serial/urlhandler/protocol_socket.py +++ b/serial/urlhandler/protocol_socket.py @@ -249,7 +249,8 @@ class Serial(SerialBase): while ready: ready, _, _ = select.select([self._socket], [], [], 0) try: - self._socket.recv(4096) + if ready: + ready = self._socket.recv(4096) except OSError as e: # this is for Python 3.x where select.error is a subclass of # OSError ignore BlockingIOErrors and EINTR. other errors are shown diff --git a/serial/win32.py b/serial/win32.py index 08b6e67..157f470 100644 --- a/serial/win32.py +++ b/serial/win32.py @@ -181,6 +181,10 @@ WaitForSingleObject = _stdcall_libraries['kernel32'].WaitForSingleObject WaitForSingleObject.restype = DWORD WaitForSingleObject.argtypes = [HANDLE, DWORD] +WaitCommEvent = _stdcall_libraries['kernel32'].WaitCommEvent +WaitCommEvent.restype = BOOL +WaitCommEvent.argtypes = [HANDLE, LPDWORD, LPOVERLAPPED] + CancelIoEx = _stdcall_libraries['kernel32'].CancelIoEx CancelIoEx.restype = BOOL CancelIoEx.argtypes = [HANDLE, LPOVERLAPPED] @@ -247,6 +251,12 @@ EV_BREAK = 64 # Variable c_int PURGE_RXCLEAR = 8 # Variable c_int INFINITE = 0xFFFFFFFF +CE_RXOVER = 0x0001 +CE_OVERRUN = 0x0002 +CE_RXPARITY = 0x0004 +CE_FRAME = 0x0008 +CE_BREAK = 0x0010 + class N11_OVERLAPPED4DOLLAR_48E(Union): pass |