GPSD is a service daemon that can monitor GPS receivers and provide the
data for multiple clients. It normally provides client data on port
2947. See the website here:
http://www.catb.org/gpsd/.
Newer versions of GPSD allow for using TCP/IP connections
to NMEA data sources including Share GPS. Follow below for
setup.
-
Obtain these packages or equivalent for your distribution:
-
gpsd -
GPS daemon, can connect to TCP sockets
-
gpsd-clients -
Helper programs for gpsd that can help with troubleshooting
problems
-
Make sure you have created a TCP/IP connection in Share GPS.
-
Before testing with GPSD, let's use netcat to be sure the strings
are coming through. If Share GPS is a TCP/IP client, setup netcat
to listen (in this example port 50000 is used):
nc -l 50000
If Share GPS is a TCP/IP server, setup netcat to connect (but
make sure Share GPS is started and listening first!). The
IP address of the phone is used below.
nc 192.168.219.282 50000
Share GPS should now indicate connected. If it does, but
no data is seen, then try setting 'Create NMEA in settings
and try again
-
Ctrl-c to get out of netcat. Now test that GPSD can connect
to Share GPS. Let's try and kill any running gpsd:
killall gpsd
-
Start GPSD in debug mode and test it out. If running Share
GPS as a server, change localhost in the following command to the
IP address of the phone (use port setup in Share GPS, in this
case 20175):
gpsd -D5 -N -n -b tcp://localhost:20175
You should see some connection info followed by the NMEA
strings.
If you are using a RedHat variant and saw something with
selinux popup or were using a Debian variant and saw
it come up and complain about not being able to bind
to the TCP ports, see the troubleshooing section.
-
Ctrl-C to get out of gpsd. Now run gpsd in the mode
you would normally run in.
gpsd -b -n tcp://localhost:20175
You will be back at a command prompt as GPSD will run
in the background.
-
Share GPS should indicate Connected at this point as the
-n switch tells GPSD to connect immediately.
Try one of the clients to ensure that works. Use 'xgps'
or 'cgps' and ensure it is getting NMEA data.
-
Now you can connect the GPSD client of your choice.
OpenCPN is an example or Navit for navigation. If wanting
to use Google Earth try
this python script
with the desired kml file specified.
python gpsd.py ./gps.kml
Troubleshooting Issues
-
For RedHat variants, I had issue with selinux blocking gpsd from using tcp ports.
Whenever I tried to run gpsd, it would pop up a window and give me the option to
add a rule allowing it, and I did that.
The other option would be to just disable selinux all together. Be sure you
understand the consequences before you do that (do the following as root):
sed -i 's/enforcing/disabled/g' /etc/sysconfig/selinux
reboot
-
For Debian variants, I had issues with it binding to tcp ports. Couldn't figure it
out, so I just rebuilt from source as opposed to using the packages. That worked
sudo apt-get remove gpsd gpsd-clients
sudo apt-get build-dep gpsd
wget http://download.savannah.gnu.org/releases/gpsd/gpsd-3.15.tar.gz
or just do a git clone of the latest
cd gpsd-3.15;sudo scons;sudo scons install
It should build and install gpsd. Now go back and try again.