summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-29 10:30:22 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-29 10:30:22 -0400
commit4667a02f7ede778f911bb8af1a01cba68802eb1a (patch)
tree800832c877704adcfd10a3cb50bf2b0e22d6f551 /serial.c
parent009ba6e3452df29cbf1757bc0c79dc14683a98da (diff)
downloadgpsd-4667a02f7ede778f911bb8af1a01cba68802eb1a.tar.gz
Attempt to support /dev/pps devices.
For these devices: 1. The hunt loop is disabled. 2. When emitting a PPS report, all other (non-/dev/pps) devices are checked for in-band time. If no time is found the report is not emitted. If time is ound its seconds field is incremented by 1 and it is used Every PPS from a device resets its online time, which should prevent /dev/pps devices from timing out too often. Not yet tested with a /dev/pps device. All regression tests oass.
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/serial.c b/serial.c
index 282d009c..28f65b2e 100644
--- a/serial.c
+++ b/serial.c
@@ -54,6 +54,8 @@ static sourcetype_t gpsd_classify(const char *path)
/* OS-independent check for ptys using Unix98 naming convention */
else if (strncmp(path, "/dev/pts/", 9) == 0)
return source_pty;
+ else if (strncmp(path, "/dev/pps", 8) == 0)
+ return source_pps;
else if (S_ISCHR(sb.st_mode)) {
sourcetype_t devtype = source_rs232;
#ifdef __linux__
@@ -637,6 +639,10 @@ bool gpsd_next_hunt_setting(struct gps_device_t * session)
if (isatty(session->gpsdata.gps_fd) == 0)
return false;
+ /* ...or if it's nominally a tty but delivers only PPS and no data */
+ if (session->sourcetype == source_pps)
+ return false;
+
if (session->lexer.retry_counter++ >= SNIFF_RETRIES) {
#ifdef FIXED_PORT_SPEED
return false;