From ff8eba473e76d1bda98344595dc79ee2a3d6d5df Mon Sep 17 00:00:00 2001 From: Kanok Chantrasmi Date: Sat, 6 Mar 2021 07:01:57 +0700 Subject: [PATCH] gpsd python error (#352) gpsd script occasionally results in python error. cause: the expected info from GPS unit on each update has more than 10 lines, therefore, python didn't find the expected wording and result in a python error correction: increase the line from gpspipe from 10 to 20 lines --- snmp/gpsd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snmp/gpsd b/snmp/gpsd index 48f1be4..70fe924 100755 --- a/snmp/gpsd +++ b/snmp/gpsd @@ -26,7 +26,7 @@ TMPFILE=$(mktemp) trap "rm -f $TMPFILE" 0 2 3 15 # Write GPSPIPE Data to Temp File -$BIN_GPIPE -w -n 10 > $TMPFILE +$BIN_GPIPE -w -n 20 > $TMPFILE # Parse Temp file for GPSD Data VERSION=`cat $TMPFILE | $BIN_GREP -m 1 "VERSION" | $BIN_PYTHON -c 'import sys,json;print json.load(sys.stdin)["rev"]'` @@ -42,4 +42,4 @@ SATSUSED=`cat $TMPFILE | $BIN_GREP -m 1 "SKY" | $BIN_PYTHON -c 'import sys,json; # Output info for SNMP Extend echo '{"data":{"mode":"'$GPSDMODE'", "hdop":"'$HDOP'", "vdop":"'$VDOP'", "latitude":"'$LAT'", "longitude":"'$LONG'", "altitude":"'$ALT'", "satellites":"'$SATS'", "satellites_used":"'$SATSUSED'"}, "error":"0", "errorString":"", "version":"'$VERSION'"}' -rm $TMPFILE \ No newline at end of file +rm $TMPFILE