This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Implement method to write/read to serials without blocking on windows with asyncio
Type: Stage: resolved
Components: asyncio Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, jabdoa, yselivanov
Priority: normal Keywords:

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:55adminsetgithub: 76577
2022-03-12 17:10:56asvetlovsetstatus: open -> closed
resolution: out of date
messages: + msg415003

stage: resolved
2017-12-22 13:23:30asvetlovsetmessages: + msg308933
2017-12-21 12:42:09jabdoacreate