summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaakan Johansson <f96hajo@chalmers.se>2010-11-13 15:12:40 +0100
committerJon Schlueter <jon.schlueter@gmail.com>2010-12-03 06:53:39 -0500
commit562831b815b65fff79e72180b5a2daa8348542fe (patch)
treeb966452e36ce7b2257242b39acefc60931eeeb6a
parent10e279c986d30309222e1f83512df24bb573f4ec (diff)
downloadgpsd-562831b815b65fff79e72180b5a2daa8348542fe.tar.gz
Allow oncore devices in postion hold mode to deliver PPS data to ntpshm.
Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
-rw-r--r--driver_oncore.c4
-rw-r--r--gpsd.h-tail1
-rw-r--r--libgpsd_core.c18
3 files changed, 21 insertions, 2 deletions
diff --git a/driver_oncore.c b/driver_oncore.c
index a72820d1..b9921756 100644
--- a/driver_oncore.c
+++ b/driver_oncore.c
@@ -143,6 +143,8 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf,
mask |= LATLON_IS | ALTITUDE_IS | SPEED_IS | TRACK_IS;
+ session->driver.oncore.good_time = 0;
+
gpsd_zero_satellites(&session->gpsdata);
/* Merge the satellite information from the Bb message. */
Bbused = 0;
@@ -174,6 +176,8 @@ oncore_msg_navsol(struct gps_device_t *session, unsigned char *buf,
st++;
if (status & 0x80)
session->gpsdata.used[nsv++] = sv;
+ if (status & 0x02)
+ session->driver.oncore.good_time = 1;
}
}
for (j = 0; (int)j < session->driver.oncore.visible; j++)
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 758a02f7..4084512f 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -448,6 +448,7 @@ struct gps_device_t {
int PRN[ONCORE_VISIBLE_CH]; /* PRNs of satellite */
int elevation[ONCORE_VISIBLE_CH]; /* elevation of satellite */
int azimuth[ONCORE_VISIBLE_CH]; /* azimuth */
+ int good_time;
double pps_delay;
} oncore;
#endif /* ONCORE_ENABLE */
diff --git a/libgpsd_core.c b/libgpsd_core.c
index b85fde6e..91400e25 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -52,6 +52,10 @@
#include <sys/un.h>
#endif
+#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE)
+extern const struct gps_type_t oncore_binary;
+#endif
+
int gpsd_switch_driver(struct gps_device_t *session, char *type_name)
{
const struct gps_type_t **dp;
@@ -423,7 +427,12 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
(unsigned long)tv.tv_sec, (unsigned long)tv.tv_usec);
/*@ +boolint @*/
- if (3 < session->context->fixcnt) {
+ if (3 < session->context->fixcnt
+#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE)
+ || (session->device_type == &oncore_binary &&
+ session->driver.oncore.good_time)
+#endif
+ ) {
/* Garmin doc says PPS is valid after four good fixes. */
/*
* The PPS pulse is normally a short pulse with a frequency of
@@ -1006,7 +1015,12 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
//gpsd_report(LOG_PROG, "NTP: bad new time\n");
} else if (session->newdata.time == session->last_fixtime) {
//gpsd_report(LOG_PROG, "NTP: Not a new time\n");
- } else if (session->newdata.mode == MODE_NO_FIX) {
+ } else if (session->newdata.mode == MODE_NO_FIX
+#if defined(ONCORE_ENABLE) && defined(BINARY_ENABLE)
+ && !(session->device_type == &oncore_binary &&
+ session->driver.oncore.good_time)
+#endif
+ ) {
//gpsd_report(LOG_PROG, "NTP: No fix\n");
} else {
double offset;