On 2009-09-01 06:05, Tomek Kruszona wrote:
Hello! I have Watchport/H sensor that monitors air humidity and temperature. I can get information about monitored values sending strings (i.e. T<CR> for temperature value) via minicom. How can I get values from serial port (/dev/ttyUSB0) using a shell script? I tried scripting in minicom and it works ok, but I get output in minicom window. I'd like to use values from Watchport for monitoring script so it would be great to get output to stdout...
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.
-- Brawndo's got what plants crave. It's got electrolytes!