summaryrefslogtreecommitdiff
path: root/recipes-navigation
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-navigation')
-rw-r--r--recipes-navigation/gpsd/gpsd/gpsd-default53
-rw-r--r--recipes-navigation/gpsd/test/README10
-rw-r--r--recipes-navigation/gpsd/test/gpsd-test.tar.gzbin0 -> 712 bytes
3 files changed, 52 insertions, 11 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default
index fa67fd1..9bc1eef 100644
--- a/recipes-navigation/gpsd/gpsd/gpsd-default
+++ b/recipes-navigation/gpsd/gpsd/gpsd-default
@@ -52,6 +52,7 @@ GPSFIX="3"
# should not need to change the baud rate.
#
function SET_GPS_SPEED {
+
if [[ $(mts-io-sysfs show hw-version) =~ ^MTHS- ]] ; then
if gpsctl -t 'u-blox' -D 5 -x '\x06\x41\x00\x00\x03\x1F\x90\x47\x4F\xB1\xFF\xFF\xEA\xFF' $GPS_LINE ; then
logger -s -t 'gpsd info' -p daemon.info "GPS LNA set high"
@@ -60,17 +61,47 @@ if [[ $(mts-io-sysfs show hw-version) =~ ^MTHS- ]] ; then
fi
fi
+((maxtries = 10))
if [[ $(cat /run/config/gpstype) == u-blox ]] ; then
- # 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
+ while ((maxtries > 0)) ; do
+ ((maxtries--))
+ if ((maxtries == 5)) ; then
+ # Not going well, so reset the GPS.
+ mts-io-sysfs store gnss-reset 0
+ usleep 50
+ mts-io-sysfs store gnss-reset 1
+ sleep 2
+ fi # Reset at maxtries == 5
+
+ # Set the baud rate to default speed if having issues
+ if ((maxtries < 8)) && ((maxtries % 2 == 1)) ; then
+ stty -F $GPS_LINE 9600
+ fi
+
+ # 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
+ speed=$(stty -F $GPS_LINE speed 2>&1)
+ if [[ $speed = 115200 ]] ; then
+ result=$(gpsctl -T 2 -f $GPS_LINE 2>&1)
+ if [[ $result =~ u-blox[[:space:]]at[[:space:]]115200[[:space:]] ]] ; then
+ break
+ fi # gpsctl has a good status
+ fi # gpsd serial port speed is correct
+ done # Loop until maxtries
+
+ if ((maxtries == 0)) && [[ -n $result ]] ; then
+ logger -s -t 'gpsd info' -p daemon.alert "gpsctl -T 2 -f $GPS_LINE"
+ logger -s -t 'gpsd info' -p daemon.alert "$GPS_LINE: $(stty -F $GPS_LINE speed) baud"
+ logger -s -t 'gpsd info' -p daemon.alert "$result"
+ fi # If out of loop with maxtries exhausted, print error
+fi # If U-Blox GPS type
}
diff --git a/recipes-navigation/gpsd/test/README b/recipes-navigation/gpsd/test/README
new file mode 100644
index 0000000..18d712f
--- /dev/null
+++ b/recipes-navigation/gpsd/test/README
@@ -0,0 +1,10 @@
+Install the test in the root file system
+of a device with ntp and gpsd installed.
+ntp must be configured to use gpsd as
+the time source.
+
+cd /
+sudo tar -xf /tmp/gpsd-test.tar.gz
+
+See /usr/share/gpsd-test/README for more
+details.
diff --git a/recipes-navigation/gpsd/test/gpsd-test.tar.gz b/recipes-navigation/gpsd/test/gpsd-test.tar.gz
new file mode 100644
index 0000000..4d74be3
--- /dev/null
+++ b/recipes-navigation/gpsd/test/gpsd-test.tar.gz
Binary files differ