aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2021-03-15 21:27:51 +0100
committerChristian Weiske <cweiske@cweiske.de>2021-03-15 21:27:51 +0100
commit023737be6524df79d22ab7f8df5a94fd7f38764e (patch)
treebb0962f055a19e484c124a86c1298de4cddda814
parenta37410bf241127c052de6bc94575cf23b0d23362 (diff)
downloadusb-wde1-tools-023737be6524df79d22ab7f8df5a94fd7f38764e.tar.gz
usb-wde1-tools-023737be6524df79d22ab7f8df5a94fd7f38764e.zip
Use variable for usb device to make it configurable more easily
-rwxr-xr-xmunin/usb-wde1-log-last.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/munin/usb-wde1-log-last.sh b/munin/usb-wde1-log-last.sh
index 9603dce..0b702de 100755
--- a/munin/usb-wde1-log-last.sh
+++ b/munin/usb-wde1-log-last.sh
@@ -11,19 +11,21 @@
#
# FIXME: send RESET or INIT and M2
+device=/dev/ttyUSB0
+
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"
+ if [ ! -r $device ]; then
+ echo "Device $device is not readable"
exit 1
fi
#socat breaks something that leads to
# WRONG VAL, WRONG CMD and FullBuff->Reset
# errors
- 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\
+ socat $device,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\
| $curdir/log-single-line.sh /tmp/usb-wde1-last
fi