2008-01-02 18:28:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# (c) Jorge Loza, Sancho Lerena 2007-2008
|
|
|
|
# Licensed under GPL2 Terms
|
|
|
|
# Pandora FMS - http://pandora.sf.net
|
|
|
|
|
|
|
|
TMPFILE=/tmp/pandora_async.tmp
|
|
|
|
SERIALPORT=/dev/usb/tts/0
|
|
|
|
|
|
|
|
variable=0
|
|
|
|
rm $TMPFILE 2> /dev/null
|
|
|
|
|
|
|
|
# Fork and let a process reading from serialport
|
|
|
|
cat < $SERIALPORT > $TMPFILE &
|
2008-02-03 20:33:24 +01:00
|
|
|
sleep 1
|
2008-01-02 18:28:09 +01:00
|
|
|
|
|
|
|
# Send gate read request to SERIALPORT
|
|
|
|
echo $1 > $SERIALPORT
|
|
|
|
|
|
|
|
until test -s $TMPFILE || test $variable -ge 200
|
|
|
|
do
|
|
|
|
variable=$(($variable + 1))
|
|
|
|
done
|
|
|
|
sleep 1
|
|
|
|
cat $TMPFILE | head -1
|
|
|
|
|
|
|
|
kill -0 $! && kill $!
|