summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd/gpsd
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-navigation/gpsd/gpsd/gpsd')
-rwxr-xr-xrecipes-navigation/gpsd/gpsd/gpsd40
1 files changed, 22 insertions, 18 deletions
diff --git a/recipes-navigation/gpsd/gpsd/gpsd b/recipes-navigation/gpsd/gpsd/gpsd
index 36ca387..1f14107 100755
--- a/recipes-navigation/gpsd/gpsd/gpsd
+++ b/recipes-navigation/gpsd/gpsd/gpsd
@@ -38,24 +38,6 @@ CAPABILITY=/sys/devices/platform/mts-io/capability/gps
([[ -n $GPS_LINE ]]) || exit 0
-((numtries = 10))
-if [[ $(cat /run/config/gpstype) == u-blox ]] ; then
- while ((numtries > 0)) ; do
- if [ -c $GPS_LINE ];then
- logger -s -t 'gpsd info' -p daemon.info $GPS_LINE" found"
- break
- fi
- sleep 1
- done
- if ((numtries == 0));then
- logger -s -t 'gpsd info' -p daemon.info $GPS_LINE" not found. gpsd will not start"
- exit 0
- fi
-else
- # Exit if no gps found
- ([[ -c $GPS_LINE ]]) || exit 0
-fi
-
# Assemble the GPS devices
# PPS device is needed so GPSD finds the PPS.
if [[ -c $GPS_PPS ]] ; then
@@ -81,6 +63,28 @@ fi
#
do_start()
{
+ # Don't bother starting GPSD if the device does not exist
+ # Wait a little bit in case the device has not yet
+ # been enumerated.
+ ((numtries = 10))
+ if [[ $(cat /run/config/gpstype) == u-blox ]] ; then
+ while ((numtries > 0)) ; do
+ ((numtries--))
+ if [[ -c $GPS_LINE ]];then
+ logger -s -t 'gpsd info' -p daemon.info $GPS_LINE" found"
+ break
+ fi
+ sleep 1
+ done
+ if ((numtries == 0));then
+ logger -s -t 'gpsd info' -p daemon.info $GPS_LINE" not found. gpsd will not start"
+ exit 0
+ fi
+ else
+ # Exit if no gps found
+ ([[ -c $GPS_LINE ]]) || exit 0
+ fi
+
/usr/sbin/start-stop-daemon -N -20 --start --quiet --pidfile $PIDFILE --exec $DAEMON --test \
-- $GPSD_OPTIONS -P $PIDFILE $GPS_DEVICES > /dev/null \
|| return 1