gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GPSD over network not working correctly


From: Gustav Vierbergen
Subject: GPSD over network not working correctly
Date: Thu, 17 Nov 2022 20:13:58 +0200

Hi All,
I require some assistance.

I am trying to get GPS over the network. I have two devices, one with a gps connected and one without. They are both connected via an ethernet switch.

Initially the system with GPS ran gpsd 3.20 and the other system ran gpsd 3.17 but cgps wasn't able to retrieve the speed, it just stated n/a but gpsmon worked correctly. I have a program which attempts to get gps values like speed, lat, long etc. but it was unable to get speed. So I decided to build gpsd 3.20 from sources on the device without GPS as well so that both are on the same gpsd version.

After building gpsd 3.20 from source, cgps started receiving speed information from gpsd but my program was still unable to retrieve speed. so I decided to write a small test program using your examples.

When running the program on the device with GPS it works perfectly, but when running on the device without GPS all the data seems wrong.

I have attached below all the important config files as well as my program and all my system details


-------------------------------------------- First Device (with GPS) ------------------------------------------------
Ubuntu 20.04
GPSD 3.20
Has an ip of 172.17.1.1
Runs GPSD as a systemctl service.
I can see all required gps stats running cgps or gpsmon or my own program based on examples (lat, long, alt, speed, time)

below is gpsd.service configuration
{
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket
}

below is gpsd.socket config
{
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets

[Socket]
ListenStream=/var/run/gpsd.sock
#ListenStream=[::1]:2947
#ListenStream=127.0.0.1:2947
# To allow gpsd remote access, start gpsd with the -G option and
# uncomment the next two lines:
ListenStream=[::1]:2947
ListenStream=0.0.0.0:2947
SocketMode=0600

[Install]
WantedBy=sockets.target
}

below is gpsd config
{
DEVICES="/dev/ttyUSB1"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
}

below is the example output of cgps and gpsmon as well as my own program

cgps
image.png

gpsmon
image.png

program
image.png

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

------------------------------------ Second Device (Without GPS) -------------------------------------------------
Ubuntu 18.04
The second device has an ip in the same range ex. 172.17.1.xx
GPSD 3.20.
When running cgps or gpsmon I receive all the GPS data I require.

below is gpsd.service configuration
{
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
EnvironmentFile=-/etc/sysconfig/gpsd
ExecStart=/usr/local/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket
}


below is gpsd.socket configuration
{
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets

[Socket]
ListenStream=/var/run/gpsd.sock
#ListenStream=[::1]:2947
#ListenStream=127.0.0.1:2947
# To allow gpsd remote access, start gpsd with the -G option and
# uncomment the next two lines:
ListenStream=[::1]:2947
ListenStream=0.0.0.0:2947
SocketMode=0600

[Install]
WantedBy=sockets.target
}

below is gpsd config file
{
# 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=""

# Other options you want to pass to gpsd
GPSD_OPTIONS=""
}

below is the example output of "cgps 172.17.1.1" and "gpsmon 172.17.1.1" as well as my own program

cgps
image.png

gpsmon
image.png

program
image.png

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

My program is attached below. Any assistance would be greatly appreciated. The same program is run on both systems some lines are just commented

Please let me know if you require any other information. if this is the wrong place to post stuff like this please redirect me to a place where I can post queries like this.

Kind Regards

Attachment: custom_gps.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]