Wednesday, April 9, 2014

tail -f /dev/ttyUSB0 in Debian

After a recent Debian 7.4 (I hate the codenames!) update I was no longer able to read data from the Arduino's USB serial.
I found out that
cat /dev/ttyUSB0
worked, while
tail -f /dev/ttyUSB0
did nothing. Strangely enough, running the command in strace revealed that tail was reading the data correctly, it just failed to display them ...

I'm not sure whom to blame - coreutils or Debian. Anyway, here's the solution/workaround I found at

$ stty -F /dev/ttyUSB0 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
$ stty -F /dev/ttyUSB0 9600 raw hupcl min 0
$ tail ---disable-inotify -f /dev/ttyUSB0

No comments:

Post a Comment