Follow this guide for the steps on getting NMEA data from
Share GPS to GPSD and Google Earth via the USB connection of
the mobile.
Once you have this working, it is possible to automate the
connection on USB plug in. Go here for that:
Automate Linux USB connections
Initial installation and check out
-
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
-
android-tools or
android-tools-adb - ADB is a must
for android usb connections, if your distro does not
have one of these packages try downloading the x86
zip straight from google:
wget http://dl-ssl.google.com/android/repository/platform-tools_r23.0.1-linux.zip
The unzip it in your directory of choice
unzip platform-tools_r23.0.1-linux.zip
-
Ensure the mobile has USB debugging enabled and plug USB into the PC
-
In Share GPS, create a new connection for NMEA USB.
The default port of 50000 should be fine for most.
-
At a terminal prompt, type:
adb devices
You should see the device listed, if it indicates offline
or unauthorized, check the mobile to see if authorization
is needed and ackknowledge.
If you had to download the platform-tools and had errors
when trying to run, see the troubleshooting section
-
Use adb to forward mobile tcp port (50000 is default)
to PC tcp port 20175 (or another port if desired).
adb forward tcp:20175 tcp:50000
-
Start the connection in Share GPS. You should see USB
listening in the status.
-
To test and make sure adb and Share GPS are working, use
the nc command to check for data coming through. You
should see the NMEA strings coming through after entering
the command.
nc localhost 20175
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.
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 tcp://localhost:20175
You will be back at a command prompt as GPSD will run
int the background.
-
Share GPS will indicate listening as GPSD does not
connect until a client connects. 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 red hat variants, I had to download platform-tools and got the following errors
when trying to run 'adb':
-
Error: '/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory'
solved by:
yum install glibc.i686
-
error while loading shared libraries: libgcc_s.so.1. Solved by:
yum install libgcc_s.so.1
-
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.
Automating connections
Follow this procedure to automate USB connections on plug in:
Automate Linux USB connections