2

I am trying to get a BU-353 GPS device to work on Ubuntu 16.04 LTS via GPSD. When I ran cgps I was greated with a timeout error.

I assumed something was wrong with the GPS because I has not been used in a while so I ran gpsmon. The gps had gained a fix on multiple saltiles and had acquired my lat and long.

This lead me to believe that something must be wrong on the GPSD side so I ran the command gpsd -N -D3 -F /dev/ttyUSB0. I was met with:

gpsd:ERROR: can't bind to local socket /dev/ttyUSB0
gpsd:ERROR: control socket create failed, netlib error -1

Even when I directed GPSD to the socket with gpsd -N -D3 -F /var/run/gpsd.sock /dev/ttyUSB0, (code lifted directly from the GPSD troubleshoot page) I was still receiving the same error.

I have no clue what is going wrong. I am very new to GPSD and not very comfortable with Ubuntu more generally so maybe I am making a simple mistake. Any help is greatly appreciated.

2 Answers 2

2

A BU-353 should work out of the box with gpsd. But you have a a few things going on,

  • the first item is systemd is in charge of launching an instance of gpsd. Until it is turned off (sudo service gpsd stop) you will be chasing your tail.
  • -F Creates a control socket for device addition and removal commands. It must be a valid pathname on your local filesystem. It is doubtful your control socket would possibly be the USB gps you're trying to read. Typically the control socket is /var/run/gpsd.sock but could be /tmp/anything
  • you need to have write permissions to open the control socket. sudo gpsd -N -D3 -F /var/run/gpsd.sock works, while gpsd -N -D3 -F /var/run/gpsd.sock will fail because non-privileged user cannot write to the control socket. Likewise, gpsd -N -D3 -F /tmp/when_pigs_fly should work. (But, none will work if a gpsd is already running.)

Additionally you must consider additional instructions in /etc/default/gpsd For example,

# 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=""

These are introduced in /lib/systemd/system/gpsd.service as an EnvironmentFile

The first line is useless. systemd is in charge and does not fork off the process. It runs with the -N flag.

I set USBAUTO="true" because gpsd's use of udev and hotplugging is fairly transparent-. Plug in something that's a gps and it works. If it's not gps, it minds it's own business.

But I do code in the location of a gps that I'm currently working with. Because, stopping/restarted gpsd without rebooting, the gpsd won't 'know' about the gps at /dev/ttyACM0 (or wherever it is) without a hotplug event. I code in the location to not have to un/plug the gps every time I restart gpsd without a reboot.

Other GPSD_OPTIONS= could include -n -G or -b at your discretion.

Additionally, there are other test clients (xgps) that are more robust for checking gps output, but that should get you pointed in the right direction.

0

It's permissions - get the same error on a raspberry that is just adding/running the command with sudo/root permissions.

sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock

3
  • is this a solution or a comment?
    – Zanna
    Jan 10, 2017 at 17:28
  • Please add some more details to describe what you are suggesting.
    – sudodus
    Jan 10, 2017 at 17:31
  • I had service gpsd start -> sudo service gpsd start Oct 14, 2017 at 0:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .