X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/blobdiff_plain/372a95ade862f2d7bd661c464a4a2a9852070dfb..8816475b592a57bb1e1703c79cbf2a26e8728461:/munin/usb-wde1-log-last.sh diff --git a/munin/usb-wde1-log-last.sh b/munin/usb-wde1-log-last.sh index 0752498..db27a13 100755 --- a/munin/usb-wde1-log-last.sh +++ b/munin/usb-wde1-log-last.sh @@ -4,11 +4,23 @@ # run this script as follows: # $ nohup ./usb-wde1-log-last.sh & # +# Use --dummy-data as parameter to log dummy data only +# # License: http://www.gnu.org/licenses/agpl.html AGPL # Author: Christian Weiske # # FIXME: send RESET or INIT and M2 -# FIXME: use absolute path for log-single-line.sh -# -socat /dev/ttyUSB0,b9600 STDOUT\ - | ./log-single-line.sh /tmp/usb-wde1-last + +curdir="$(dirname "$0")" +if [ "$1" = "--dummy-data" ]; then + $curdir/../dummy-data-generator.php\ + | $curdir/log-single-line.sh /tmp/usb-wde1-last +else + if [ ! -r /dev/ttyUSB0 ]; then + echo "Device /dev/ttyUSB0 is not readable" + exit 1 + fi + + socat /dev/ttyUSB0,b9600 STDOUT\ + | $curdir/log-single-line.sh /tmp/usb-wde1-last +fi