summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO12
-rw-r--r--gpsd.xml39
-rw-r--r--libgpsd_core.c11
3 files changed, 55 insertions, 7 deletions
diff --git a/TODO b/TODO
index 66f44470..f612b9e0 100644
--- a/TODO
+++ b/TODO
@@ -169,6 +169,18 @@ This is a good idea for supporting hands-free operation, e.g. while driving.
It would be an easy first project for somebody who wants to get into
the client code.
+*** Enable gpsd to open chronyd socket as root in /var/run
+
+At the moment gpsd drops priviledges as soon as the command line
+options are parsed. A way needs to be found to open the chronyd
+sockets in /var/run before dropping root.
+
+*** Enhance libgps to decode SUBFRAME JSON
+
+gpsd now passes along GPS subframe date in JSON. The libgps needs to
+be extended to decode this data. A sample program to dump the SUBFRAME
+data would also be useful.
+
*** Set the system time zone from latitude/longitude
If we're going to give gpsd the capability to set system time via
diff --git a/gpsd.xml b/gpsd.xml
index b46b93bd..eba44710 100644
--- a/gpsd.xml
+++ b/gpsd.xml
@@ -2652,9 +2652,8 @@ century.</para>
<para>gpsd can provide reference clock information to
<application>ntpd</application>, to keep the system clock synchronized
-to the time provided by the GPS receiver. This facility is
-only available when the daemon is started from root. If you're going
-to use <application>gpsd</application> you probably want to run it
+to the time provided by the GPS receiver. If you're going to
+use <application>gpsd</application> you probably want to run it
<option>-n</option> mode so the clock will be updated even when no
clients are active.</para>
@@ -2667,7 +2666,9 @@ of every clock second on the carrier-detect lines of some serial
GPSes; this pulse can be used to update NTP at much higher accuracy
than message time provides. You can determine whether your GPS emits
this pulse by running at -D 5 and watching for carrier-detect state
-change messages in the logfile.</para>
+change messages in the logfile. In addition, if your kernel provides
+the RFC 2783 kernel PPS API then <application>gpsd</application> will
+use that for extra accuracy.</para>
<para>When <application>gpsd</application> receives a sentence with a
timestamp, it packages the received timestamp with current local time
@@ -2741,6 +2742,36 @@ type of receiver. Please send us the output of the "ntpq -p" command
and the make and type of receiver.</para>
</refsect1>
+<refsect1 id='chrony'><title>USE WITH CHRONY</title>
+<para>gpsd can provide reference clock information to
+<application>chronyd</application> similar to the way it talks to
+<application>ntpd</application>. The advantage to using chrony is
+that the PPS time resolution is in nSec. This is 1,000 times more
+precision than the time resolution provided to ntpd.
+</para>
+<para>gpsd talks to <application>chronyd</application> using a socket
+named /tmp/chrony.ttyXX.sock (where ttyXX is replaced by the GPS
+device name. This allows multiple GPS to feed one <application>chronyd
+</application>.
+</para>
+<para>No gpsd configuration is required to talk to chronyd. To get
+chronyd to connect to gpsd using the SHM method add this to your
+/etc/chrony/chonry.conf file.
+</para>
+<screen>
+# delay 0.0 is right, but use 0.2 to avoid NMEA
+# time fighting with PPS time
+refclock SHM 0 offset 0.0 delay 0.2
+refclock SHM 1 offset 0.0 delay 0.0
+</screen>
+<para>To get chronyd to connect to gpsd using the more precise socket
+method add this to your /etc/chrony/chrony.conf file (replacing ttyXX
+with your device name): </para>
+<screen>
+#refclock PPS
+/dev/pps0 refclock SOCK /var/run/chrony.ttyXX.sock
+</screen>
+</refsect1>
<refsect1 id='dbus'><title>USE WITH D-BUS</title>
<para>On operating systems that support D-BUS,
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a561201d..5d383a51 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -394,19 +394,24 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
char *chrony_path = NULL;
gpsd_report(LOG_PROG, "PPS Create Thread gpsd_ppsmonitor\n");
+#ifdef __UNUSED__
+ /* sadly root was dropped very early, until a way if found to run this
+ * before dropping root it will not work. */
if( 0 == getuid() ) {
/* only root can use /var/run */
chrony_path = "/var/run/chrony";
- } else {
+ } else
+#endif
+ {
chrony_path = "/tmp/chrony";
}
s.sun_family = AF_UNIX;
(void)snprintf(s.sun_path, sizeof (s.sun_path), "%s.%s.sock", chrony_path,
basename(session->gpsdata.dev.path));
- /* the socket will be either, for root:
+ /* TODO the socket for root would be
* /var/run/chrony.ttyXX.sock
- * or for non-root:
+ * for now it is always
* /tmp/chrony.ttyXX.sock
*/