using asyncio to access a serial port

687 views
Skip to first unread message

James Richardson

unread,
Feb 11, 2014, 8:32:23 AM2/11/14
to python...@googlegroups.com

(cross post from c.l.p)

Hiya

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.

Essentially, opening the serial port is all fine, i just need a way to register reader/writer listeners on an fd. Perhaps I've missed something amazingly obvious...

Any advice on where to proceed would be very much appreciated!

Thanks!!

James



Saúl Ibarra Corretgé

unread,
Feb 11, 2014, 9:03:01 AM2/11/14
to James Richardson, python...@googlegroups.com
Hi! Have a look at this:
http://www.python.org/dev/peps/pep-3156/#i-o-callbacks


--
Saúl Ibarra Corretgé
bettercallsaghul.com

Saúl Ibarra Corretgé

unread,
Feb 11, 2014, 9:05:28 AM2/11/14
to James Richardson, python...@googlegroups.com
On 02/11/2014 02:32 PM, James Richardson wrote:
>

James Richardson

unread,
Feb 11, 2014, 9:09:57 AM2/11/14
to Saúl Ibarra Corretgé, python...@googlegroups.com
oh wow. it was hiding in plain sight.

thanks very much - i'll try that right away.

Cheers!

James

Victor Stinner

unread,
Feb 11, 2014, 9:35:46 AM2/11/14
to James Richardson, Saúl Ibarra Corretgé, python-tulip
2014-02-11 15:09 GMT+01:00 James Richardson <ja...@time4tea.net>:
> oh wow. it was hiding in plain sight.

A added a new "Watch file descriptors" section to asyncio
documentation a few days ago, I just forgot to document these methods.
http://docs.python.org/dev/library/asyncio-eventloop.html#watch-file-descriptors

Victor
Reply all
Reply to author
Forward
0 new messages