On 2009-09-01 06:31, Tomek Kruszona wrote:
Ron Johnson wrote:
The problem I see is knowing when new data arrives on /dev/ttyUSB0.
There's obviously a solution, since minicom does it, but it might
involve async interrupt handlers, which would probably require a small C
program which reads /dev/ttyUSB0 and outputs it to stdout.
Digging through the source code of /usr/bin/tail to see how it
implements the "-f" option would also be helpful.
Thank you for your quick answer!
I'm not programmer so I hope that there is ready-to-use program that
does the same as minicom but without interface and able to work in
one-line script :)
I just Googled "linux listen to serial port", and got several
interesting hits.
From reading those links, this Python snippet *might* work:
import sys
f = open('/dev/ttyUSB0', 'r')
try:
while 1:
l = f.readline()
print l
except:
f.close
--
Brawndo's got what plants crave. It's got electrolytes!
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org