diff options
author | John Klug <john.klug@multitech.com> | 2019-03-14 18:45:03 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-07-03 17:08:20 -0500 |
commit | 59577ff375700df533b3ac68f94d9da75574164a (patch) | |
tree | b2b4a5d929d44931da1b853f0ac5c5a84a1f853c /recipes-navigation | |
parent | 2a97e3077fe153df7093539ae35ddb866fce9921 (diff) | |
download | meta-mlinux-59577ff375700df533b3ac68f94d9da75574164a.tar.gz meta-mlinux-59577ff375700df533b3ac68f94d9da75574164a.tar.bz2 meta-mlinux-59577ff375700df533b3ac68f94d9da75574164a.zip |
Move U-Blox specific commands out of /etc/init.d/gpsd, and don't set baud rate of Venus.
Diffstat (limited to 'recipes-navigation')
-rwxr-xr-x | recipes-navigation/gpsd/gpsd/gpsd | 15 | ||||
-rw-r--r-- | recipes-navigation/gpsd/gpsd/gpsd-default | 43 |
2 files changed, 48 insertions, 10 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd index 781e109..33a8470 100755 --- a/recipes-navigation/gpsd/gpsd/gpsd +++ b/recipes-navigation/gpsd/gpsd/gpsd @@ -71,16 +71,11 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - # 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 + + if [[ -n ${SET_GPS_SPEED} ]] ; then + eval "${SET_GPS_SPEED}" + fi + /usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES \ || return 2 diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default index 5c59791..bb4df93 100644 --- a/recipes-navigation/gpsd/gpsd/gpsd-default +++ b/recipes-navigation/gpsd/gpsd/gpsd-default @@ -27,3 +27,46 @@ GPS_FIXFILE=/var/run/gpsfix # 04 GPS + dead reckoning combined # 05 Time only fix GPSFIX="03 05" + +# U-Blox defaults to 9600. If the +# default speed is not set before changing +# the baud rate, this does not work +# except right after a boot when the speed +# is 9600 baud. +# +# 115200 baud is preferred to reduce the CPU +# load. Also, u-blox mode is preferred to +# nmea, as it is more efficient. +# +# We check for U-Blox first, because +# we do not set the baud rate of other +# GPS types. +# +# This gpsctl does not always work, because +# the line speed might be wrong, so if we +# fail, we change the baud rate and try again. +# +# There should only be two speeds, 115200 +# or 9600. +# +# If the line speed is already 115200, we +# should not need to change the baud rate. +# +read -r -d '' SET_GPS_SPEED <<"EOF" +if [[ $(cat /run/config/gpstype) == u-blox ]] ; then + logger -t 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 -t gpsd -p daemon.info "WARNING: Unable to set GPS serial port speed." + stty -F $GPS_LINE 9600 + if ! gpsctl -T 20 -t u-blox -s $GPS_BAUD -b -f $GPS_LINE ; then + logger -t gpsd -p daemon.info "WARNING: Unable to set GPS serial port speed." + fi + fi + stty -F $GPS_LINE $GPS_BAUD + logger -t 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 +EOF + + |