From 1a9755712cac194ac821b19b8c4e98a04c8efdae Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 25 Jan 2021 03:36:13 -0600 Subject: If gpsctl is successful the first time, quit --- recipes-navigation/gpsd/gpsd/gpsd-default | 15 ++++++++++++--- recipes-navigation/gpsd/gpsd_3.20.bb | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) mode change 100644 => 100755 recipes-navigation/gpsd/gpsd/gpsd-default (limited to 'recipes-navigation') diff --git a/recipes-navigation/gpsd/gpsd/gpsd-default b/recipes-navigation/gpsd/gpsd/gpsd-default old mode 100644 new mode 100755 index 9bc1eef..b4bf11b --- 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) diff --git a/recipes-navigation/gpsd/gpsd_3.20.bb b/recipes-navigation/gpsd/gpsd_3.20.bb index e177884..b6a3773 100644 --- a/recipes-navigation/gpsd/gpsd_3.20.bb +++ b/recipes-navigation/gpsd/gpsd_3.20.bb @@ -4,7 +4,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://COPYING;md5=01764c35ae34d9521944bb6ab312af53" DEPENDS = "dbus dbus-glib ncurses python3 libusb1 chrpath-replacement-native pps-tools" PROVIDES = "virtual/gpsd" -PR="m2" +PR="m3" EXTRANATIVEPATH += "chrpath-native" -- cgit v1.2.3