summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-05-03 17:35:19 -0500
committerJohn Klug <john.klug@multitech.com>2019-05-03 17:35:19 -0500
commitf7914c714d8e4d7d29b365b8deec8e24b86f0612 (patch)
tree46b4eccd90349db58453415d290d8df64e4416d1 /recipes-navigation/gpsd/gpsd
parent4c17d20b3feb24224110ed71a507f5655ef3d4a7 (diff)
downloadmeta-mlinux-f7914c714d8e4d7d29b365b8deec8e24b86f0612.tar.gz
meta-mlinux-f7914c714d8e4d7d29b365b8deec8e24b86f0612.tar.bz2
meta-mlinux-f7914c714d8e4d7d29b365b8deec8e24b86f0612.zip
Copy gpsd-3.16 from mLinux 4.1.9 for better gps initialization
Diffstat (limited to 'recipes-navigation/gpsd/gpsd')
-rwxr-xr-xrecipes-navigation/gpsd/gpsd/gpsd12
-rw-r--r--recipes-navigation/gpsd/gpsd/gpsd-default72
2 files changed, 20 insertions, 64 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd
index 95e2a84..3f93442 100755
--- a/recipes-navigation/gpsd/gpsd/gpsd
+++ b/recipes-navigation/gpsd/gpsd/gpsd
@@ -51,13 +51,13 @@ fi
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
-#if [ -z "$GPSD_SOCKET" ] && [ -z "$GPS_DEVICES" ]; then
-# GPSD_SOCKET=/var/run/gpsd.sock
-#fi
+if [ -z "$GPSD_SOCKET" ] && [ -z "$GPS_DEVICES" ]; then
+ GPSD_SOCKET=/var/run/gpsd.sock
+fi
-#if [ -n "$GPSD_SOCKET" ]; then
-# GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"
-#fi
+if [ -n "$GPSD_SOCKET" ]; then
+ GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"
+fi
#
# Function that starts the daemon/service
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
}