Nice, didn't know that. Streamlining is good, I'll update it with that later. In the meantime, I added a beep feature. Turns out there isn't a PC speaker on this all-in-one kiosk I'm using, but there are Alsa speakers. So here's my solution for that (Thanks for the original idea go to Ryne Everett on StackExchange):
Code:
#!/usr/bin/env bash
_alarm() {
( \speaker-test --frequency $1 --test sine )&
pid=$!
\sleep 0.${2}s
\kill -9 $pid
}
stty 57600 sane -echo -echok -icrnl -ixon -icanon -opost -onlcr time 3 min 0 < /dev/ttyUSB1
while true; do
cat /dev/ttyUSB1 | sed -e 's/\(.\)/\1 /g' |\
sed s/,/comma/g | \
sed s/@/at/g |\
while read LINE; do
if [ "$LINE" != "" ]; then
LINE=`echo $LINE Return`
xdotool key $LINE 2> /dev/null
if [ "`echo $LINE | grep '^at'`" != "" ]; then
_alarm 1200 120 &> /dev/null
fi
fi
done 2> /dev/null
done
Bookmarks