initial commit
[Serial_RGB_Controller] / serial
1 #!/bin/bash 
2
3 if [ -s "$TMP" ]; then 
4         binSRC=$( cat "$TMP" | grep Linking | sed -e 's/Linking //g' )
5         cp "$binSRC" .
6
7         serialPort=$(cat "$TMP" | grep "opening port" | awk '{split($0,a," "); print a[3]}')
8 else
9         serialPort=/dev/ttyUSB0
10 fi
11
12 echo "Serial: $serialPort"
13
14
15 if cat "$TMP" | grep -q 'error'; then 
16         echo "exit"
17 else 
18         if [ "$1" != "noserial" ]; then
19
20                 echo "Connecting $serialPort"
21
22                 stty -F $serialPort cs8 cstopb -ixon raw speed 115200
23
24                 while [ 1 ]; do
25                         cat $serialPort
26                         sleep 1
27                 done
28         else 
29                 echo "Serial terminal omited"
30         fi
31 fi 
32
Contact me: dev (at) shalnoff (dot) com
PGP fingerprint: A6B8 3B23 6013 F18A 0C71 198B 83D8 C64D 917A 5717