2019-09-01 00:52:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
port=/dev/ttyUSB0
|
|
|
|
cmdfile=~/annunciatorServer.txt
|
|
|
|
|
|
|
|
## Setup serial port
|
2019-09-02 12:21:14 +02:00
|
|
|
## speed 9600 baud; rows 0; columns 0; line = 0;
|
|
|
|
## intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 0; time = 0;
|
|
|
|
## -parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
|
|
|
|
## -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
|
|
|
|
## -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
|
|
|
|
## -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
|
|
|
|
stty -F $port 0:4:8bd:0:3:1c:7f:15:4:0:0:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
|
2019-09-01 00:52:57 +02:00
|
|
|
|
|
|
|
## Setup files
|
|
|
|
touch $cmdfile
|
|
|
|
|
|
|
|
## Monitor file for new commands
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
incmd=$(head -c 1 $cmdfile)
|
|
|
|
if [ _$incmd != _ ]
|
|
|
|
then
|
|
|
|
echo $incmd > $port
|
|
|
|
> $cmdfile
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|