Issue 32396: Implement method to write/read to serials without blocking on windows with asyncio (original) (raw)

Issue32396

Created on 2017-12-21 12:42 by jabdoa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg308869 - (view) Author: (jabdoa) Date: 2017-12-21 12:42
This is a follow up to Issue30539. The main issue is that serial ports on windows do not behave like socket on unix. Therefore, pyserial-asyncio cannot use the asyncio socket api. Can we implement serial_recv and serial_send in asyncio? This would help to create a true platform independent implementation. On Linux and Mac serial_send/recv could probably just call to socket_sendall/recv. On Windows this would map to ProactorEventLoop.send/recv.
msg308933 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2017-12-22 13:23
Looking on serial port support in twisted (https://github.com/twisted/twisted/blob/trunk/src/twisted/internet/_win32serialport.py) I see that it is implemented by OVERLAPPED structure and ReadFile/WriterFile calls. On other hand loop.sock_send() in ProactorEventLoop uses Proactor.send() (https://github.com/python/cpython/blob/master/Lib/asyncio/windows_events.py#L457). The method calls WriteFile is sock is not socket.socket instance. Did you check if `loop.sock_send()`/`loop.sock_recv()` works for serail port object?
msg415003 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-03-12 17:10
No activity, closing.
History
Date User Action Args
2022-04-11 14:58:55 admin set github: 76577
2022-03-12 17:10:56 asvetlov set status: open -> closedresolution: out of datemessages: + stage: resolved
2017-12-22 13:23:30 asvetlov set messages: +
2017-12-21 12:42:09 jabdoa create