Commit Graph

27 Commits

Author SHA1 Message Date
Oliver Smith 68bcf620b4 Fix build against gpsd >= 3.20
The previous version was written against gpsd 3.10. This also makes the
date more precise, previously microseconds were set to 0.

GPSD_API_MAJOR_VERSION is defined in gps.h, together with a changelog:

Use Pau's compat_gps_read() from:

Related: SYS#6222
2022-12-14 19:25:01 +01:00
Oliver Smith da8c043c7b gitignore: new file 2022-12-14 12:43:37 +01:00
Harald Welte d59eb51be6 gpsdate: Discard gpsd reports when no fix or no satellites used
We've observed several times that GPS receivers would report a wrong
time/date directly after boot, probably assuming that their RTC is

Let's wait until the receiver reports it has a fix and reports actual
satellites were used to compute it.
2019-08-17 12:54:24 +02:00
Pau Espin cd7b77ef31 gpsdate.service: Install correctly when service is enabled
systemctl enable requires an Install section with some target to know
how to set up correctly the service.
2017-07-24 18:54:36 +02:00
Harald Welte 81690ca78e gpsdate.init: Use GPSDATE_{HOST,PORT} from /etc/default/gpsdate
so far only the sytemd service file used those variables, but not the
init script.  Fix that.
2016-08-01 14:00:23 +02:00
Harald Welte 8c0f608643 add gps-watchdog
gps-watchdog is a small tool that will connect to gpsd as a client using
libgps.  If no data is received for a configurable timeout, a
configurable systemd service will be killed via 'systemctl kill'.

The idea is that this will restart gpsd, and some ExecStartPre of the
gpsd service is then re-initializing the gps receiver hardware.
2015-08-05 09:44:45 +02:00
Holger Hans Peter Freyther cb50b4bb9f Add an option to not fork and use it
For systemd it is better to not fork. Add an option for that.

Fixes: SYS#1152
2015-02-14 23:31:25 +01:00
Holger Hans Peter Freyther 2326eee789 systemd: Add a simple service file gpsdate
Expect that it forks and that a /etc/default/gpsdate file does
2015-02-14 15:36:46 +01:00
Harald Welte 019d2535b6 Allow user to specify a non-standard gpsd port
.. which is required on the ODU.
2014-12-20 15:46:56 +01:00
Harald Welte 75cbc3d0e5 Allow configuration of number of retconnect-attempts/interval 2014-12-20 15:44:30 +01:00
Harald Welte c77a9b3342 reconnect to gpsd if it disappears while we wait for fix/time
In some cases, gpsd might die while we are waiting to receive a valid
fix/time information.  In that case, we have to reconnect to gpsd
again and again, until a valid time has been received (and set as
system clock).
2013-10-14 10:39:34 +02:00
Harald Welte cb65bc5348 avoid using 99% CPU in case gpsd dies
This addresses and issue when gpsdate is running and the gpsd will be
killed (testing coredump handling).

The issue is within the libgps cod itself that doesn't handle the
result(0) of the recv syscall correctly and keeps on looping. Now in a
normal system gpsdate should only execute at the beginning and exit once
there is a date. So the window for this runtime failure is quite low.

Bug reported by Holger Freyther.
2013-08-29 17:12:25 +02:00
Holger Hans Peter Freyther 0db898e4b8 gpsdate.init: Make the killing of gpsdate work on the target
When the initscript is called gpsdate it might kill itself before
it has a way to start the new gpsdate process. Use pidof with the
full path to the gpsdate binary to avoid this.
2013-06-20 11:17:53 +02:00
Holger Hans Peter Freyther f07a52709f gpsdate.init: Implement stop using killall for now
The easiest way would be to use start-stop-daemon and let it
daemonize the process and create a pid file. Because all of this
is not there and the application unconditionally daemonizes itself
I can just use killall to stop it.
2013-06-20 10:13:18 +02:00
Holger Hans Peter Freyther 660b1b7fb7 gpsdate.init: Fix calling stop and start in the initscript
Now a stop/start could result in having two gpsdate processes
running. They luckily will die once the time has been set.
2013-06-20 10:13:14 +02:00
Harald Welte 8632014640 update init script defaults for update-rc.d 2013-04-10 16:09:58 +02:00
Harald Welte 58e3cdeb19 run until we receive valid GPS timestamp 2013-04-10 15:15:35 +02:00
Harald Welte 4ad6c932c9 daemonize after gpsd connection is established; gps fix might take time 2013-04-10 14:06:25 +02:00
Harald Welte 9964203e03 Makefile: Move -lgps to the end for particularly picky linkers 2013-04-10 13:55:10 +02:00
Harald Welte 374dc34c26 Makefile: don't put "-lgps" into LDFLAGS as this is overridden by bitbake/poky 2013-04-10 13:52:23 +02:00
Harald Welte 26067799c5 add GPLv2 2013-04-10 13:17:35 +02:00
Harald Welte 097f7dea48 add example init script for gpsdate 2013-04-10 13:03:22 +02:00
Harald Welte 3b870221a9 gpsdate: log the actual time that was set to the RTC. 2013-04-10 12:23:16 +02:00
Harald Welte f56f16539b use syslog() for reporting errors and status 2013-04-10 12:16:33 +02:00
Harald Welte e3708f5040 Add -Wall and -O2 to CFLAGS 2013-04-10 12:16:18 +02:00
Harald Welte a1aa41e813 perform up to 60 attmepts to re-connect to gpsd and print more status 2013-04-10 12:11:12 +02:00
Harald Welte 346b5d00a9 initial checkin of 'gpsdate' program 2013-04-10 10:47:19 +02:00