summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2006-08-18 22:02:59 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2006-08-18 22:02:59 +0000
commit50acf7e142a3521cb914a91d51a7745ec938a064 (patch)
tree6cb402c847c20dbf032f0c0133dcba7e999f6ec4 /drivers.c
parent92b9b2e8e4555f86934f403df1463c189a8270d5 (diff)
downloadgpsd-50acf7e142a3521cb914a91d51a7745ec938a064.tar.gz
Use OpenBSD's nmea(4) line discipline.
OpenBSD has the nmea(4) line discipline which, when activated, feeds the incoming bytes through an in-kernel nmea parser to extract timing info which is then exported via the sensors framework for consumption by ntpd, among others... Not so useful if your GPS can't do PPS. Patch from Jason Wright in private email.
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers.c b/drivers.c
index 15724deb..1572d5ab 100644
--- a/drivers.c
+++ b/drivers.c
@@ -4,6 +4,7 @@
#include <errno.h>
#include <stdio.h>
#include <math.h>
+#include <sys/ioctl.h>
#include <sys/time.h>
#include <stdarg.h>
@@ -64,6 +65,17 @@ gps_mask_t nmea_parse_input(struct gps_device_t *session)
#endif /* NON_NMEA_ENABLE */
gpsd_report(1, "unknown sentence: \"%s\"\n", session->outbuffer);
}
+#ifdef NMEADISC
+ if (st & TIME_SET && session->gpsdata.ldisc == 0) {
+ int ldisc = NMEADISC;
+
+ if (ioctl(session->gpsdata.gps_fd, TIOCSETD, &ldisc) == -1)
+ gpsd_report(1, "can't set nmea discipline\n");
+ else
+ session->gpsdata.ldisc = NMEADISC;
+ }
+#endif
+
#ifdef NTPSHM_ENABLE
/* this magic number is derived from observation */
if ((st & TIME_SET) != 0 &&