summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd/gpsd-default
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-navigation/gpsd/gpsd/gpsd-default')
-rwxr-xr-x[-rw-r--r--]recipes-navigation/gpsd/gpsd/gpsd-default15
1 files changed, 12 insertions, 3 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default
index 9bc1eef..b4bf11b 100644..100755
--- a/recipes-navigation/gpsd/gpsd/gpsd-default
+++ b/recipes-navigation/gpsd/gpsd/gpsd-default
@@ -79,13 +79,22 @@ if [[ $(cat /run/config/gpstype) == u-blox ]] ; then
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
+ gpsctlout=$(gpsctl -T 20 -t 'u-blox' -s $GPS_BAUD -b -f $GPS_LINE 2>&1)
+ result=$?
+ if [[ $gpsctlout =~ u-blox[[:space:]]at[[:space:]]115200[[:space:]]baud ]] ; then
+ break
+ fi
+
+ if ((result != 0)) ; then
+ echo $gpsctlout
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
+ gpsctlout=$(gpsctl -T 2 -f $GPS_LINE 2>&1)
+ if [[ $gpsctlout =~ u-blox[[:space:]]at[[:space:]]115200[[:space:]]baud ]] ; then
+ break
+ fi
stty -F $GPS_LINE $GPS_BAUD
fi
speed=$(stty -F $GPS_LINE speed 2>&1)