2 # logs the last line. usable via nohup on the server
4 # run this script as follows:
5 # $ nohup ./usb-wde1-log-last.sh &
7 # Use --dummy-data as parameter to log dummy data only
9 # License: http://www.gnu.org/licenses/agpl.html AGPL
10 # Author: Christian Weiske <cweiske@cweiske.de>
12 # FIXME: send RESET or INIT and M2
14 curdir="$(dirname "$0")"
15 if [ "$1" = "--dummy-data" ]; then
16 $curdir/../dummy-data-generator.php\
17 | $curdir/log-single-line.sh /tmp/usb-wde1-last
19 if [ ! -r /dev/ttyUSB0 ]; then
20 echo "Device /dev/ttyUSB0 is not readable"
24 #socat breaks something that leads to
25 # WRONG VAL, WRONG CMD and FullBuff->Reset
27 socat /dev/ttyUSB0,b9600,min=1,time=1,brkint=0,icrnl=0,ixoff=1,imaxbel=0,opost=0,isig=0,icanon=0,iexten=0,echo=0,echoe=0,echok=0 STDOUT\
28 | $curdir/log-single-line.sh /tmp/usb-wde1-last