Commit Graph

14 Commits

Author SHA1 Message Date
Oliver Sedlbauer 4faa112269 gpsd: add wrapper script for hotplug/respawn handling
Gpsd needs some time to create its Unix socket after the process starts.
The hotplug call in service_started() is triggered too early, before the
socket is ready, causing failures in scripts that depend on it.

Additionally, when gpsd crashes and procd respawns it, service_started() is
not called again, so no hotplug event is emitted on respawn. Therefore scripts
listening for gpsd availability miss the STARTED event.

This commit ensures the hotplug call waits for the socket to appear,
so dependent scripts reliably see the STARTED event, even after respawns.

Signed-off-by: Oliver Sedlbauer <os@dev.tdt.de>
2026-03-02 13:36:30 +01:00
Florian Eckert ace9f160ce gpsd: migrate option device to a list devices
More than one device can be added to the gpsd at startup. Currently the gpsd
service start script in OpenWrt treats this as an option with only one value.
To allow multiple devices to be specified, the uci 'option device' must be
removed and a new uci 'list devices' is added.

This change means that several devices can be specified at gpsd start with
the new uci 'list devices' configuration.

Running configurations in the field are migrated by a migration script.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Florian Eckert e377d07afd gpsd: add readonly option to uci
The 'readonly' option tells the GPSD that it is not allowed to write to the
GPS TTY, only reading the NMEA data stream is allowed. This option of the
GPSD must be set for my mobile radio device MV31, otherwise the GPSD can not
read the NMEA data stream on the GPS TTY because the GPSD blocks during
plugin probing.

gpsd:PROG: CORE: Probing "Garmin USB binary" driver...
gpsd:PROG: CORE: Probe not found "Garmin USB binary" driver...
gpsd:PROG: CORE: Probing "GeoStar" driver...
gpsd:PROG: Sent GeoStar packet id 0xc1

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Florian Eckert c954b960c4 gpsd: only add device to procd start call if device option is configured
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Florian Eckert d7fae14030 gpsd: add hotplug handling
The 'gpsd' offers the possibility to call the script '/etc/gpsd/device-hook'
when a GPS source was added or removed via gpsdctl.

In addition to the '/etc/gpsd/device-hook' call an event is now triggered
too after the 'gpsd' has started. This allows scripts to configurre 'gpsd'
receivers.

The following events are available for '/etc/hotplug.d/gpsd' scripts:

* ACTIVATE   via '/etc/gpsd/device-hook'
* DEACTIVATE via '/etc/gpsd/device-hook'
* STARTED    via '/etc/init.d/gpsd'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Florian Eckert 7ca3ffebff gpsd: add the possibility to start the gpsd with a different log level
This simplifies the handling of log levels if we need more log information
during development.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Florian Eckert f420a7bb37 gpsd: add control socket '/var/run/gpsd.sock' on startup
This change makes it possible to add new gps device without restarting the
'gpsd' service by using the 'gpsdctl' command.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-28 08:13:00 +01:00
Jeffery To bd5a6155b1 gpsd: Update init script
This replaces the use of uci_validate_section() with
uci_load_validate(), which removes the need to declare local variables
for every config option.

This also adds a service_triggers() function and removes some
unnecessary curly brackets.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
2019-02-11 22:17:06 +08:00
p-wassi 4a752d7f6f utils/gpsd: fix init script
Add missing character in init script to match config file

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
2017-03-04 12:06:22 +01:00
p-wassi 933d93c68a utils/gpsd: switch to procd
Rewrite init script for procd support

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
2017-01-21 10:07:16 +01:00
p-wassi 6aaca067d2 utils/gpsd: remove hotplug script
Remove a hotplug script, which starts/stops gpsd with
attaching/detaching a PL2302 USB-UART device.

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
2016-12-07 22:00:50 +01:00
p-wassi 5099e731b3 utils/gpsd: (cosmetic) update config
Make the default config look like usual,
i.e.: indentation using tabs, single quotes, booleans 0/1

Signed-off-by: Paul Wassi <p.wassi@gmx.at>
2016-12-07 21:58:05 +01:00
Pushpal Sidhu 0c8cc4aee0 gpsd: don't enable by default
Because this selects ttyUSB0 (bad choice) by default, turn off enabling gps
by default until the user set's the tty manually and will stop gpsd from
stomping on another device's tty.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
2016-04-21 12:03:50 -07:00
Pushpal Sidhu 8da4be4843 gpsd: initial add to packages
This package is currently in oldpackages. Add here to keep support for gpsd.

From oldpackages, this was bumped from 3.10 -> 3.15 and includes an upstream
patch to allow building with musl.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
2015-10-19 17:23:46 -07:00