summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd/gpsd-default
blob: bb4df936ef022aef5d3503bd7636a5dc7c549ff7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ENABLED="yes"
#GPSD_SOCKET="/var/run/gpsd.sock"
GPSD_SOCKET=""
GPSD_OPTIONS="-n -D 1" 

# Conduit 0.1 GPS devices
GPS_LINE=/dev/gps0
GPS_PPS=/dev/pps0

# Highest speed permitted by uBlox.
GPS_BAUD=115200

# Use this if you must use a specific pps
# that does not exist prior to gpsd running.
# GPS_DEVICES="/dev/gps1 /dev/pps1"

GPS_FIXFILE=/var/run/gpsfix

# GPSD/UBlox Lock requiremnt
# Create GPS_FIXFILE when reached.
# UBlox NAV SOL (0x01 0x06) at gpsFix value
# and above
# 00 No Fix
# 01 Dead reckoning only
# 02 2D fix
# 03 3D fix
# 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