• Operation confirmed with testing in our ODROID XU4 on
    • ubuntu-18.04-4.14-mate-odroid-xu4-20180501.img (Kernel Version 4.14.37-135).
    • ubuntu-16.04-mate-odroid-xu3-20170731.img (Kernel Version 3.10.105-141).
  • You should have been done apt update && apt full-upgrade.
  • You have to install gpsd, gpsd-clients packages to proceed.

Configure gpsd

  • Put an actual GPS device node as the DEVICES option.
  • Although you don't enter any value for DEVICES option, you can use GPS utilities by putting actual GPS device node as the executable's parameter when you execute them.
    • Example)
      odroid@odroid:~$ gpsmon /dev/ttyACM0 

Edit /etc/default/gpsd file as the below.

odroid@odroid:~$ sudo vi /etc/default/gpsd
# Default settings for the gpsd init script and the hotplug wrapper.
 
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyACM0"
# Other options you want to pass to gpsd
GPSD_OPTIONS="

Restart GPS daemon to apply edited GPS daemon configuration.

/* GPS daemon stop/disable */
odroid@odroid:~$ sudo systemctl stop gpsd.socket
odroid@odroid:~$ sudo systemctl disable gpsd.socket
/* GPS daemon enable/start */
odroid@odroid:~$ sudo systemctl enable gpsd.socket
odroid@odroid:~$ sudo systemctl start gpsd.socket

Using the GPS

  • If timeout caused due to the disconnection of GPS daemon, kill GPS daemon processes and re-enable GPS daemon, then try again.
    • Example)
      odroid@odroid:~$ sudo killall gpsd
      /* GPS daemon stop/disable */
      odroid@odroid:~$ sudo systemctl stop gpsd.socket
      odroid@odroid:~$ sudo systemctl disable gpsd.socket
      /* GPS daemon enable/start */
      odroid@odroid:~$ sudo systemctl enable gpsd.socket
      odroid@odroid:~$ sudo systemctl start gpsd.socket

Method 1: Console Graphical

  • You can use
    odroid@odroid:~$ cgps -s

    It will show a nice interface with all of the related GPS data.

  • Or You can use
    odroid@odroid:~$ gpsmon

Method 2: Console Text (Python)

  • Run:
    odroid@odroid:~$ sudo apt-get install python-gps
testgps.py
import gps
 
# Listen on port 2947 (gpsd) of localhost
session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)
 
while True:
    try:
    	report = session.next()
		# Wait for a 'TPV' report and display the current time
		# To see all report data, uncomment the line below
		# print report
        if report['class'] == 'TPV':
                print report.time
    except KeyError:
		pass
    except KeyboardInterrupt:
		quit()
    except StopIteration:
		session = None
		print "GPSD has terminated"

Method 3: X11 FoxtrotGPS

  • Install foxtrotgps (X11 for a graphical view)
    odroid@odroid:~$ sudo apt-get install foxtrotgps
  • Just open a terminal and run:
    odroid@odroid:~$ foxtrotgps