Statistics
| Branch: | Revision:

root / util / read.sh @ 420df25b

History | View | Annotate | Download (403 Bytes)

1
#!/bin/bash
2

    
3
stty 9600 raw < /dev/ttyUSB0
4
#-echo -echok -icrnl -ixon -icanon -opost -onlcr 
5

    
6
xxd -r readhex > /dev/ttyUSB0
7

    
8
sleep 0.1
9

    
10
response=`head -c 5 /dev/ttyUSB0`
11
ok=`printf "\001"`
12

    
13
if [ ${response:0:1} = $ok ]; then
14
  echo -n ${response:1} | xxd
15
else
16
  # if it failed, it hangs waiting for more characters anyway, so this never
17
  # happens unless the serial port is missing :(
18
  echo Failed.
19
fi