How to get your external USB gps working with OpenCPN in a linux chroot environment
1.) Follow my installation
instructions Building on Motorola Xoom | Official OpenCPN Homepage
2.) Confirm you have the necessary android drivers - pl2303 and for Garmin devices garmin_gps. See last post for how to do this.
3.) For Xoom owners you will need an OTG cable for connecting the gps to your android device. USB On-The-Go - Wikipedia, the free encyclopedia
Other device owners should determine whether this cable is required. Use your favourite search engine
. They're cheap
. Use the cable that came with your gps to connect to the OTG cable.
For Garmin users, loading the android pl2303 and garmin_gps modules is facilitated by creating two executable files in /etc/init.d . Use the android FX file manager downloadable from Google Play to create the files and change permissions to make them executable.
Users who's gps does not require a driver only need the first file that loads pl2303.
Contents of files:
For Garmin users only! If you do not have a Garmin, the second file will be different if your gps requires a driver. Type the name of your driver in place of 'garmin_gps. If no driver is required for your gps, the second file is not needed.
Once the necessary file(s) have been created reboot your device.
Open an android terminal (downloadable from Google Play).
At the prompt:
You should see output indicating pl2303 and garmin_gps (Garmin users only) modules are loaded.
Connect your gps and turn on.
At terminal prompt:
This should provide output confirming your gps has been recognized and a socket created /dev/ttyUSB0 through USB?. The socket created consistently for me is /dev/ttyUSB5.
'lsusb' will list your usb devices. The gps device will be something like Bus 002 Device 002: ID 091e:0003 Garmin International GPS (various models)' . Adapt the numbers from Bus and Device to the next step.
Next, 'ls -l /dev/bus/usb/002/002 (last number given by lsusb) confirms the device exists.
Assuming user is logged as root the command to start gpsd is 'gpsd -n -D 6 -N /dev/ttyUSB5 or whatever USB number was indicated in the dmesg output.
If everything has been done correctly you should see data output from gps.
Using FX file manager create another file in /date/local/linux//mnt/etc/init.d called 'startgps'
Copy and paste into the file:
sudo killall gpsd
sudo gpsd -n -D 6 -N /dev/ttyUSB5 &
#Note: substitute the ttyUSB device number obtained with 'dmesg' command.
Save the file and change permissions so it is executable.
Start Linux Deploy. Click on the arrow icon at the top right. It is pointing downward.
Enable 'Custom startup' then click on Script file. Type /etc/init.d/startgps.
Stop Linux Deploy.
Reboot your android device.
Open Linux Deploy and click on start.
Open your VNC viewer (akRDC)and connect to the desktop
. Start OpenCPN.
Click on the wrench (settings) in the menu bar.
Click on Connections.
Click on Add Connection
Choose Network and GPSD. Address will be normally be localhost. DataPort 2947.
Click on Add Connection.
. DataPort will be /dev/ttyUSB5 or whatever USB port number was indicated in the 'dmesg' command. Baudrate 4800. For Garmin users select Use Garmin (GRMN) mode for input and Use Garmin GRMN (Host) mode for uploads. Accept other default options.
BOTH CONNECTIONS MUST BE ENABLED! Why I do not know...
Click on Apply.
Your gps should be working in OpenCPN.
Problems? Post here for assistance.