In order to get GPS position fixes onto the PC and use them, we need
- GPS device(s) attached to the PC
- kernel driver for the device
- userspace driver for the device
- service process distributing position fixes on the computer
This page collects the current facts and proposes a few ideas of how to make things work.
- 1 GPS Devices
- 2 How to get position fixes from a Garmin GPS60 via USB
- 3 How programs get their position fixes
You can connect a GPS receiver to the PC using several methods: RS232(serial), USB, Bluetooth. RS232 devices will need a more or less manual setup, while the USB and Bluetooth devices can be set up automatically once the proper infrastructure bits are installed.
As an example, I will explain the current situation in Fedora 11 with a Garmin GPS60 connected via USB. I am aware that situation will change significantly with HAL being replaced for Fedora 12, but you need to start somewhere.
CAUTION: If there is a daemon type program continously getting position fixes from a GPS device, it might be difficult/impossible to upload/download waypoints, routes and tracks. This will need to be considered eventually.
How to get position fixes from a Garmin GPS60 via USB
For getting position fixes into the system, three issues need solving:
- find the correct device file
- set up permissions to the device file
- run some software reading from the device file and distributing the position fixes on the PC
How to access the USB device
With the GPS60, there are two options:
- With kernel's
garmin-gpsdriver emulating serial device
- Using the USB protocol via a
/dev/bus/usb/001/005device and libusb
As serial devices are the standard in the GPS device world, using the
emulated one would be nice and compatible. However, the
kernel driver is much better at doing NULL pointer dereferences than
at doing anything useful (and it appears to declared deprecated anyway).
So we are going to use the device's USB protocol via
can be achieved if we just add a new line to
Device Permission Setup
Fedora 11 does not contain any mechanism to set up the permissions to GPS USB devices in any way.
By default, the
garmin-gps kernel module (yes, the
NULL-pointer-dereferencing one) is being loaded and the resulting
/dev/ttyUSB0 device is being treated like a modem, permission-wise.
Nothing at all is being done on the
As we have already blacklisted
garmin-gps above, we are now halfway set up alread.
We still need to do three things:
- Give HAL an information/.../10-gps-devices.fdi file listing all known GPS devices
- Give HAL a policy/.../10-gps-devices.fdi file which sets up permissions "properly"
- Add a
gpspolicy to HAL's device-access policy in
We can now easily make backups of the waypoints routes tracks stored on the GPS with a command line such as
$ gpsbabel -t -r -w -i garmin -f usb: -o gpx -F gps-backup-$(date -I).gpx
Which software to use for gathering position fixes
- gpsd (shares position via TCP port or experimental
- gypsy (shares position via
- GPS drivers directly in application (e.g. GarminDev in QLandkarteGT)
- gpsbabel experimental feature to output NMEA data into a named FIFO, which could then be read as a serial NMEA device
gpsd can gather position fixes from many GPS devices and distributes the position fixes via a TCP port and an experimental DBUS protocol.
We could either run gpsd as an unconfined_t non-root user - which is easy when there is just one GPS connected to the system, maximum. However, we need to start it more or less manually, which sucks.
We could also run gpsd as a system service (user
and modify the
HAL database such that new devices are added to gpsd's list of devices to be polled when they are plugged in. However, that is relatively complicated to set up SELinux wise (needs new
gps_device_t for the device file, and then
gpsd_t processes access to those device files) and (and this is the
deal killer) gpsd ONLY speaks the serial protocol. This is apparently an
explicit design decision to avoid depending on libusb.
However, this means we can only use gpsd with USB devices with the buggy
garmin-gps kernel driver. That rules out using gpsd to connect to the
Unfortunately, while I find a lot of discussion on how gypsy is supposedly
better than gpsd, I cannot find any hints as to how to actually invoke gypsy, or which software can actually read its position fixes from
GarminDev in QLandkarteGT
Unfortunately, the only thing GarminDev is currently able to do on my system is to throw an error message about not being able to communicate with the GPS device.
We have seen above in the waypoint/route/track backup: Unlike all the programs built to get position fixes from the GPS, gpsbabel can at least communicate with it in some way. Unfortunately, we don't want W/R/T uploads or downloads right now. We want GPS position fixes, but gpsbabel cannot read position fixes... or can it?
As of this writing, Garmin's PVT protocol and NMEA are supported inputs. KML, NMEA, and the variou XCSV formats are supported on output.
$ mkfifo fake-gps $ gpsbabel -T -i garmin -f usb: -o nmea -F fake-gps $ gpsd -n fake-gps
Interestingly, this complicated setup actually works, as verified by running merkaartor.
However, this setup needs some messing with gpsd's SELinux permissions:
Even if the user starting gpsd is
unconfined_t, the default gpsd policy module has the actual daemon process change context. So the quick workaround is
# semodule -r gpsd # fixfiles -R gpsd restore
You can revert these SELinux related changes by running
# semodule -i /usr/share/selinux/targeted/gpsd.pp.bz2 # fixfiles -i gpsd restore
While it is nice to see that there is a way to get GPS position fixes into the PC, this method as it stands may work but is not suitable for any official inclusion:
- gpsd should continue to run as
gpsd_t, and while we're at it, we could also lock gpsbabel into its own SELinux cage
- This solution is unnecessarily complicated with the two processes involved.
Use the GPS position fix
- Moving map display
- Mapping GSM/UMTS signal strength.
- Create OSM maps
- Road navigation
For something which should work more or less automatically, attaching a GPS device to get your position and doing a moving map display or navigation based on that position still requires an awful lot of work.
How programs get their position fixes
- Unknown fields are empty
- Unsupported relations are marked -
- Supported relations are marked ✔ (untested or not working)
- Supported relations which actually work are marked ✔✔