summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd/gpsd-default
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-navigation/gpsd/gpsd/gpsd-default')
-rw-r--r--recipes-navigation/gpsd/gpsd/gpsd-default72
1 files changed, 14 insertions, 58 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default
index 46c64a3..7dd5372 100644
--- a/recipes-navigation/gpsd/gpsd/gpsd-default
+++ b/recipes-navigation/gpsd/gpsd/gpsd-default
@@ -1,6 +1,8 @@
ENABLED="yes"
-#GPSD_SOCKET="/var/run/gpsd.sock"
-GPSD_SOCKET=""
+
+# GPSD control socket for sending GPSD commands.
+# GPSD_SOCKET="/var/run/gpsd.sock"
+
GPSD_OPTIONS="-n -D 1"
# Conduit 0.1 GPS devices
@@ -51,62 +53,16 @@ GPSFIX="3"
#
function SET_GPS_SPEED {
if [[ $(cat /run/config/gpstype) == u-blox ]] ; then
- logger -st gpsd -p daemon.info "Attempting to set baud rate to ${GPS_BAUD}"
- out=$(gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE)
- rslt=$?
- if ((rslt == 0)) && [[ $out =~ ${GPS_BAUD}[[:space:]]baud\. ]] ; then
- logger -st gpsd -p daemon.info "GPS serial port speed is $GPS_BAUD."
- return 0
- fi
-
- if ((rslt != 0)) ; then
- logger -st gpsd -p daemon.warning "Unable to set read the GPS, try again."
- speed=$(stty -F $GPS_LINE)
- if ((speed == GPS_BAUD)) ; then
- stty -F $GPS_LINE 9600
- else
- stty -F $GPS_LINE 115200
- fi
- fi
-
- out=$(gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE)
- rslt=$?
- if ((rslt == 0)) && [[ $out =~ ${GPS_BAUD}[[:space:]]baud\. ]] ; then
- logger -st gpsd -p daemon.info "GPS serial port speed is $GPS_BAUD."
- return 0
- fi
-
- if ((rslt != 0)) ; then
- speed=$(stty -F $GPS_LINE)
- if ((speed == GPS_BAUD)) ; then
- stty -F $GPS_LINE 9600
- else
- stty -F $GPS_LINE ${GPS_BAUD}
- fi
- fi
-
- out=$(gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE)
- rslt=$?
- if ((rslt == 0)) && [[ $out =~ ${GPS_BAUD}[[:space:]]baud\. ]] ; then
- logger -st gpsd -p daemon.info "GPS serial port speed is $GPS_BAUD."
- return 0
- fi
-
- if ((rslt != 0)) ; then
- speed=$(stty -F $GPS_LINE)
- if ((speed == GPS_BAUD)) ; then
- stty -F $GPS_LINE 9600
- else
- stty -F $GPS_LINE ${GPS_BAUD}
- fi
- fi
- out=$(gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE)
- rslt=$?
- if ((rslt == 0)) && [[ $out =~ ${GPS_BAUD}[[:space:]]baud\. ]] ; then
- logger -st gpsd -p daemon.info "GPS serial port speed is $GPS_BAUD."
- return 0
- fi
- logger -st gpsd -p daemon.err "Cannot set GPS serial port speed, speed is $GPS_BAUD."
+ # Set the baud rate. Works better with ntp at a higher baud rate.
+ if ! gpsctl -T 20 -t 'u-blox' -s $GPS_BAUD -b -f $GPS_LINE ; then
+ echo 'WARNING: Unable to set GPS serial port speed.'
+ else
+ # The next line is needed due to a bug in gpsctl.
+ # We will go back to the default baud rate if we don't do this step.
+ echo Expect a timeout error here. Need this error.
+ gpsctl -T 2 -f $GPS_LINE
+ stty -F $GPS_LINE $GPS_BAUD
+ fi
fi # End of U-Blox GPS type
}