Skip to contentSkip to conversation

Accessing USB thermometer sensor

DISCUSSION Josh Hammond 1 participant 1 message Jun 24, 2008 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · Tosoni
Quoted 3 lines

the right direction to be able to read the temperature from command line? Josh

Reading a serial device from the commannd line is not easy. First because each command you type closes the port after running and so it flushes buffers.

I would suggest using shell parenthesis to group the commands Use stty to set the port to raw mode etc.
Use 'echo' and 'dd' which is like 'cat' but much more configurable for

buffer sizes

Quoted 2 lines

something like:
( stty 9600 raw; echo 'request'; dd bs=1 count=10 >response.out)

</dev/serialusb >&0

Quoted 2 lines

Unfortunately it doesn't seem to work.
This is the general output (I tried several tty speeds):

osmosis:/home/josh# ( stty 9600 raw; echo 'request'; dd bs=1 count=10
Quoted 1 line

response.out) < /dev/ttyUSB0 >&0

bash: echo: write error: Bad file descriptor
0+0 records in
0+0 records out
0 bytes (0 B) copied, 32.3506 s, 0.0 kB/s

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html