summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-04-01 18:46:43 -0500
committerJohn Klug <john.klug@multitech.com>2019-04-01 18:46:43 -0500
commit8bc6c573775ee9845cd859e83ba4128c482d0b4f (patch)
treef5d5a1572ebed2b5bb7d64c2e58818a90075c79d
parent9311629bccb42dccddf78138ecda7fe65194cf4d (diff)
downloadmeta-mlinux-atmel-8bc6c573775ee9845cd859e83ba4128c482d0b4f.tar.gz
meta-mlinux-atmel-8bc6c573775ee9845cd859e83ba4128c482d0b4f.tar.bz2
meta-mlinux-atmel-8bc6c573775ee9845cd859e83ba4128c482d0b4f.zip
Errors are due to wrong speed on EXAR TTY, which can happen with a no reset reboot.
-rw-r--r--recipes-navigation/gpsd/gpsd/gpsd-default72
-rw-r--r--recipes-navigation/gpsd/gpsd_3.18.1.bb2
2 files changed, 56 insertions, 18 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default
index 3450731..46c64a3 100644
--- a/recipes-navigation/gpsd/gpsd/gpsd-default
+++ b/recipes-navigation/gpsd/gpsd/gpsd-default
@@ -51,24 +51,62 @@ 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}"
- if ! gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE ; then
- logger -st gpsd -p daemon.warning "Unable to set GPS serial port speed."
- stty -F $GPS_LINE 9600
- sleep 1
- if ! gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE ; then
- logger -st gpsd -p daemon.warning "Unable to set GPS serial port speed."
- stty -F $GPS_LINE $GPS_BAUD
- sleep 1
- if ! gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE ; then
- logger -st gpsd -p daemon.warning "Unable to set GPS serial port speed -- giving up!"
+ 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
- fi
- stty -F $GPS_LINE $GPS_BAUD
- logger -st gpsd -p daemon.info "Expect a timeout error here. Need this error."
- gpsctl -T 2 -f $GPS_LINE
- stty -F $GPS_LINE $GPS_BAUD
-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."
+fi # End of U-Blox GPS type
}
diff --git a/recipes-navigation/gpsd/gpsd_3.18.1.bb b/recipes-navigation/gpsd/gpsd_3.18.1.bb
index 975482c..bbc1f88 100644
--- a/recipes-navigation/gpsd/gpsd_3.18.1.bb
+++ b/recipes-navigation/gpsd/gpsd_3.18.1.bb
@@ -4,7 +4,7 @@ LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-replacement-native pps-tools"
PROVIDES = "virtual/gpsd"
-PR="m6"
+PR="m7"
EXTRANATIVEPATH += "chrpath-native"