Using asyncio for serial port

Marko Rauhamaa marko at pacujo.net
Tue Feb 11 17:42:45 CET 2014


james.time4tea at gmail.com:

> I'm looking at using asyncio for creating an socket <-> serial
> protocol bridge, but looking at the current implementation of asyncio
> it looks to be quite socket specific.
>
> I can't see any way to get it to support a simple serial device.

Never tried it, but if you can open the serial device and get its file
descriptor, you should be able to use

  http://docs.python.org/3.4/library/asyncio-eventloop.html#watch-file-descriptors

BTW, the specification doesn't indicate if the reader/writer callbacks
are level-triggered or edge-triggered. I'm afraid they are
level-triggered.

At any rate, asyncio looks like a real positive development in
Pythonland.


Marko



More information about the Python-list mailing list