From 2ae441d42411d416e9e3f39c60f6c14d23708f74 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 31 Oct 2013 23:49:55 -0400 Subject: Contain the assumption that time hinting is done to NTPD. Because it might be going to chrony. Or something else. No logic changes, just name changes and one new derived #define, TIMEHINT_ENABLE. --- driver_evermore.c | 6 +-- driver_garmin.c | 24 +++++------ driver_geostar.c | 12 +++--- driver_italk.c | 6 +-- driver_navcom.c | 6 +-- driver_nmea2000.c | 6 +-- driver_oncore.c | 12 +++--- driver_proto.c | 12 +++--- driver_sirf.c | 34 ++++++++-------- driver_superstar2.c | 6 +-- driver_tsip.c | 12 +++--- driver_ubx.c | 6 +-- driver_zodiac.c | 12 +++--- drivers.c | 102 +++++++++++++++++++++++------------------------ gpscap.ini | 22 +++++----- gpscap.py | 10 ++--- gpsd.c | 8 ++-- gpsd.h-tail | 13 +++--- libgpsd_core.c | 4 +- subframe.c | 4 +- www/writing-a-driver.xml | 19 ++++++--- 21 files changed, 175 insertions(+), 161 deletions(-) diff --git a/driver_evermore.c b/driver_evermore.c index 50b4823f..092da3a1 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -633,9 +633,9 @@ const struct gps_type_t evermore_binary = #ifdef CONTROLSEND_ENABLE .control_send = evermore_control_send, /* how to send a control string */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* defined(EVERMORE_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_garmin.c b/driver_garmin.c index 32015573..ea33320b 100644 --- a/driver_garmin.c +++ b/driver_garmin.c @@ -1224,8 +1224,8 @@ static ssize_t garmin_control_send(struct gps_device_t *session, } #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE -static double garmin_ntp_offset(struct gps_device_t *session) +#ifdef TIMEHINT_ENABLE +static double garmin_time_offset(struct gps_device_t *session) { if (session->sourcetype == source_usb) { return 0.035; /* Garmin USB, expect +/- 40mS jitter */ @@ -1244,7 +1244,7 @@ static double garmin_ntp_offset(struct gps_device_t *session) } return 0.430; /* WTF? WAG */ } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ /* this is everything we export */ #ifdef __UNUSED__ @@ -1391,9 +1391,9 @@ const struct gps_type_t garmin_usb_binary_old = #ifdef CONTROLSEND_ENABLE .control_send = garmin_control_send, /* send raw bytes */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = garmin_ntp_offset, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = garmin_time_offset, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* __UNUSED__ */ @@ -1420,9 +1420,9 @@ const struct gps_type_t garmin_usb_binary = #ifdef CONTROLSEND_ENABLE .control_send = garmin_control_send, /* send raw bytes */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = garmin_ntp_offset, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = garmin_time_offset, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ @@ -1448,9 +1448,9 @@ const struct gps_type_t garmin_ser_binary = #ifdef CONTROLSEND_ENABLE .control_send = garmin_control_send, /* send raw bytes */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = garmin_ntp_offset, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = garmin_time_offset, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_geostar.c b/driver_geostar.c index d819e4ad..7830eaad 100644 --- a/driver_geostar.c +++ b/driver_geostar.c @@ -599,12 +599,12 @@ static void geostar_mode(struct gps_device_t *session, int mode) } #endif /* RECONFIGURE_ENABLE */ -#ifdef NTPSHM_ENABLE -static double geostar_ntp_offset(struct gps_device_t *session UNUSED) +#ifdef TIMEHINT_ENABLE +static double geostar_time_offset(struct gps_device_t *session UNUSED) { return 0.31; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ /* this is everything we export */ /* *INDENT-OFF* */ @@ -629,9 +629,9 @@ const struct gps_type_t geostar_binary = #ifdef CONTROLSEND_ENABLE .control_send = geostar_control_send,/* how to send commands */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = geostar_ntp_offset, -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = geostar_time_offset, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_italk.c b/driver_italk.c index 2521351f..cdb3c7b9 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -418,9 +418,9 @@ const struct gps_type_t italk_binary = #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* no control string sender */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* defined(ITRAX_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_navcom.c b/driver_navcom.c index 5c6fbd24..d67acde9 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -1296,9 +1296,9 @@ const struct gps_type_t navcom_binary = #ifdef CONTROLSEND_ENABLE .control_send = navcom_control_send, /* how to send a control string */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_nmea2000.c b/driver_nmea2000.c index 42b00f5b..621fb615 100644 --- a/driver_nmea2000.c +++ b/driver_nmea2000.c @@ -1617,9 +1617,9 @@ const struct gps_type_t nmea2000 = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_oncore.c b/driver_oncore.c index 0152933a..45929451 100644 --- a/driver_oncore.c +++ b/driver_oncore.c @@ -454,8 +454,8 @@ static void oncore_event_hook(struct gps_device_t *session, event_t event) } } -#ifdef NTPSHM_ENABLE -static double oncore_ntp_offset(struct gps_device_t *session UNUSED) +#ifdef TIMEHINT_ENABLE +static double oncore_time_offset(struct gps_device_t *session UNUSED) { /* * Only one sentence (NAVSOL) ships time. 0.175 seems best at @@ -464,7 +464,7 @@ static double oncore_ntp_offset(struct gps_device_t *session UNUSED) */ return 0.175; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ static gps_mask_t oncore_parse_input(struct gps_device_t *session) { @@ -503,9 +503,9 @@ const struct gps_type_t oncore_binary = { /* Control string sender - should provide checksum and headers/trailer */ .control_send = oncore_control_send, /* to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = oncore_ntp_offset, /* NTP offset array */ -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = oncore_time_offset, /* NTP offset array */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* defined(ONCORE_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_proto.c b/driver_proto.c index f9f7f060..17413e80 100644 --- a/driver_proto.c +++ b/driver_proto.c @@ -453,8 +453,8 @@ static void _proto__set_mode(struct gps_device_t *session, int mode) } #endif /* RECONFIGURE_ENABLE */ -#ifdef NTPSHM_ENABLE -static double _proto_ntp_offset(struct gps_device_t *session) +#ifdef TIMEHINT_ENABLE +static double _proto_time_offset(struct gps_device_t *session) { /* * If NTP notification is enabled, the GPS will occasionally NTP @@ -468,7 +468,7 @@ static double _proto_ntp_offset(struct gps_device_t *session) */ return MAGIC_CONSTANT; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ static void _proto__wrapup(struct gps_device_t *session) { @@ -525,9 +525,9 @@ const struct gps_type_t _proto__binary = { /* Control string sender - should provide checksum and headers/trailer */ .control_send = _proto__control_send, #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = _proto_ntp_offset, -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = _proto_time_offset, +#endif /* TIMEHINT_ENABLE */ /* *INDENT-ON* */ }; #endif /* defined(_PROTO__ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_sirf.c b/driver_sirf.c index 48902343..646ae94f 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -486,9 +486,9 @@ static gps_mask_t sirf_msg_swversion(struct gps_device_t *session, gpsd_report(session->context->debug, LOG_PROG, "SiRF: fv: %0.2f, Driver state flags are: %0x\n", fv, session->driver.sirf.driverstate); -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE session->driver.sirf.time_seen = 0; -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ gpsd_report(session->context->debug, LOG_DATA, "SiRF: FV MID 0x06: subtype='%s' mask={DEVICEID}\n", session->subtype); @@ -577,7 +577,7 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, && session->driver.sirf.dgps_source == SIRF_DGPS_SOURCE_SBAS) session->gpsdata.used[session->gpsdata.satellites_used++] = prn; } -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE if (st < 3) { gpsd_report(session->context->debug, LOG_PROG, "SiRF: NTPD not enough satellites seen: %d\n", st); @@ -589,15 +589,15 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, session->gpsdata.skyview_time, session->context->leap_seconds); } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ gpsd_report(session->context->debug, LOG_DATA, "SiRF: MTD 0x04: visible=%d mask={SATELLITE}\n", session->gpsdata.satellites_visible); return SATELLITE_SET; } -#ifdef NTPSHM_ENABLE -static double sirf_ntp_offset(struct gps_device_t *session) +#ifdef TIMEHINT_ENABLE +static double sirf_time_offset(struct gps_device_t *session) /* return NTP time-offset fudge factor for this device */ { double retval = NAN; @@ -650,7 +650,7 @@ static double sirf_ntp_offset(struct gps_device_t *session) return retval; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t len) @@ -695,7 +695,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, /* byte 21 is "mode 2", not clear how to interpret that */ session->newdata.time = gpsd_gpstime_resolve(session, (unsigned short)getbes16(buf, 22), (double)getbeu32(buf, 24) * 1e-2); -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE if (session->newdata.mode <= MODE_NO_FIX) { gpsd_report(session->context->debug, LOG_PROG, "SiRF: NTPD no fix, mode: %d\n", @@ -706,7 +706,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, session->driver.sirf.time_seen, session->newdata.time, session->context->leap_seconds); } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ /* fix quality data */ session->gpsdata.dop.hdop = (double)getub(buf, 20) / 5.0; mask |= @@ -846,7 +846,7 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, gpsd_report(session->context->debug, LOG_PROG, "SiRF: GND 0x29 UTC: %lf\n", session->newdata.time); -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE if (session->newdata.mode <= MODE_NO_FIX) { gpsd_report(session->context->debug, LOG_PROG, "SiRF: NTPD no fix, mode: $d\n", @@ -864,7 +864,7 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, mask |= PPSTIME_IS; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ /* skip 4 bytes of satellite map */ session->newdata.altitude = getbes32(buf, 35) * 1e-2; /* skip 1 byte of map datum */ @@ -979,7 +979,7 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, /*@ -compdef */ session->newdata.time = (timestamp_t)mkgmtime(&unpacked_date) + subseconds; /*@ +compdef */ -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE if (0 == (session->driver.sirf.time_seen & TIME_SEEN_UTC_2)) { gpsd_report(session->context->debug, LOG_RAW, "SiRF: NTPD just SEEN_UTC_2\n"); @@ -988,7 +988,7 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, "SiRF: NTPD valid time MID 0x62, seen=0x%02x\n", session->driver.sirf.time_seen); session->driver.sirf.time_seen |= TIME_SEEN_UTC_2; -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ session->context->valid |= LEAP_SECOND_VALID; } @@ -1034,7 +1034,7 @@ static gps_mask_t sirf_msg_ppstime(struct gps_device_t *session, /*@ +compdef */ session->context->leap_seconds = (int)getbeu16(buf, 8); session->context->valid |= LEAP_SECOND_VALID; -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE if (0 == (session->driver.sirf.time_seen & TIME_SEEN_UTC_2)) { gpsd_report(session->context->debug, LOG_RAW, "SiRF: NTPD just SEEN_UTC_2\n"); @@ -1044,7 +1044,7 @@ static gps_mask_t sirf_msg_ppstime(struct gps_device_t *session, session->driver.sirf.time_seen, session->context->leap_seconds); session->driver.sirf.time_seen |= TIME_SEEN_UTC_2; -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ mask |= TIME_SET; if ( 3 <= session->gpsdata.satellites_visible ) { mask |= PPSTIME_IS; @@ -1385,8 +1385,8 @@ const struct gps_type_t sirf_binary = #ifdef CONTROLSEND_ENABLE .control_send = sirf_control_send,/* how to send a control string */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = sirf_ntp_offset, +#ifdef TIMEHINT_ENABLE + .time_offset = sirf_time_offset, #endif /* NTP_SHM_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_superstar2.c b/driver_superstar2.c index 31a8658c..9761c824 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -575,9 +575,9 @@ const struct gps_type_t superstar2_binary = { /* Control string sender - should provide checksum and trailer */ .control_send = superstar2_control_send, #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* defined(SUPERSTAR2_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_tsip.c b/driver_tsip.c index 087dfccf..6dced174 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -1151,13 +1151,13 @@ static void tsip_mode(struct gps_device_t *session, int mode) } #endif /* RECONFIGURE_ENABLE */ -#ifdef NTPSHM_ENABLE -static double tsip_ntp_offset(struct gps_device_t *session UNUSED) +#ifdef TIMEHINT_ENABLE +static double tsip_time_offset(struct gps_device_t *session UNUSED) { /* FIX-ME: is a constant offset right here? */ return 0.075; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ void configuration_packets_generic(struct gps_device_t *session) /* configure generic Trimble TSIP device to a known state */ @@ -1274,9 +1274,9 @@ const struct gps_type_t tsip_binary = #ifdef CONTROLSEND_ENABLE .control_send = tsip_control_send,/* how to send commands */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = tsip_ntp_offset, -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = tsip_time_offset, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_ubx.c b/driver_ubx.c index d1bda91d..feb14b11 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -840,9 +840,9 @@ const struct gps_type_t ubx_binary = { #ifdef CONTROLSEND_ENABLE .control_send = ubx_control_send, /* no control sender yet */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* defined(UBX_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_zodiac.c b/driver_zodiac.c index 296dbece..14e15f28 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -445,8 +445,8 @@ static bool zodiac_speed_switch(struct gps_device_t *session, } #endif /* RECONFIGURE_ENABLE */ -#ifdef NTPSHM_ENABLE -static double zodiac_ntp_offset(struct gps_device_t *session UNUSED) +#ifdef TIMEHINT_ENABLE +static double zodiac_time_offset(struct gps_device_t *session UNUSED) { /* Removing/changing the magic number below is likely to disturb * the handling of the 1pps signal from the gps device. The regression @@ -454,7 +454,7 @@ static double zodiac_ntp_offset(struct gps_device_t *session UNUSED) * with the 1pps signal active is required. */ return 1.1; } -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ /* this is everything we export */ /* *INDENT-OFF* */ @@ -479,9 +479,9 @@ const struct gps_type_t zodiac_binary = #ifdef CONTROLSEND_ENABLE .control_send = zodiac_control_send, /* for gpsctl and friends */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = zodiac_ntp_offset, /* compute NTO fudge factor */ -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = zodiac_time_offset, /* compute NTO fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/drivers.c b/drivers.c index b6727417..90eb5689 100644 --- a/drivers.c +++ b/drivers.c @@ -101,9 +101,9 @@ const struct gps_type_t unknown = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ @@ -265,9 +265,9 @@ const struct gps_type_t nmea = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ @@ -366,9 +366,9 @@ const struct gps_type_t garmin = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* GARMIN_ENABLE && NMEA_ENABLE */ @@ -428,9 +428,9 @@ const struct gps_type_t ashtech = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* ASHTECH_ENABLE */ @@ -479,9 +479,9 @@ const struct gps_type_t fv18 = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* FV18_ENABLE */ @@ -533,9 +533,9 @@ const struct gps_type_t gpsclock = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* GPSCLOCK_ENABLE */ @@ -588,9 +588,9 @@ static const struct gps_type_t tripmate = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* TRIPMATE_ENABLE */ @@ -639,9 +639,9 @@ static const struct gps_type_t earthmate = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* never actually used. */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /*@ -redef @*/ /* *INDENT-ON* */ @@ -762,9 +762,9 @@ const struct gps_type_t trueNorth = { #ifdef CONTROLSEND_ENABLE .control_send = tnt_control_send, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif @@ -840,9 +840,9 @@ static const struct gps_type_t oceanServer = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif @@ -907,9 +907,9 @@ static const struct gps_type_t fury = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ @@ -961,9 +961,9 @@ static const struct gps_type_t rtcm104v2 = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* RTCM104V2_ENABLE */ @@ -1007,9 +1007,9 @@ static const struct gps_type_t rtcm104v3 = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* RTCM104V3_ENABLE */ @@ -1042,9 +1042,9 @@ static const struct gps_type_t garmintxt = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* GARMINTXT_ENABLE */ @@ -1136,9 +1136,9 @@ const struct gps_type_t mtk3301 = { #ifdef CONTROLSEND_ENABLE .control_send = nmea_write, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* MTK3301_ENABLE */ @@ -1374,9 +1374,9 @@ const struct gps_type_t aivdm = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* no control sender */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no NTP communication */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no NTP communication */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ #endif /* AIVDM_ENABLE */ @@ -1472,9 +1472,9 @@ const struct gps_type_t json_passthrough = { #ifdef CONTROLSEND_ENABLE .control_send = NULL, /* how to send control strings */ #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - .ntp_offset = NULL, /* no method for NTP fudge factor */ -#endif /* NTPSHM_ ENABLE */ +#ifdef TIMEHINT_ENABLE + .time_offset = NULL, /* no method for NTP fudge factor */ +#endif /* TIMEHINT_ENABLE */ }; /* *INDENT-ON* */ diff --git a/gpscap.ini b/gpscap.ini index 533150e4..8c2bc308 100644 --- a/gpscap.ini +++ b/gpscap.ini @@ -24,7 +24,7 @@ # usbchip = USB I/O chipset # pps = supports pulse-per-second precision time reporting # pps_accuracy = claimed PPS accuracy -# ntp_offset = NTP offset +# time_offset = NTP offset # configurable = can the device be bricked by speed changes? # tested = last gpsd tested, or "regression" if we have a test load # nmea = NMEA version this emits, if known @@ -871,7 +871,7 @@ nmea = 2.0 and 2.3 packaging = mouse pps = True pps_accuracy = 1us -ntp_offset = 0.125s +time_offset = 0.125s submitter = Gary E. Miller techdoc = http://www.garmin.com/manuals/GPS18_TechnicalSpecification.pdf tested = 2.5 @@ -1162,7 +1162,7 @@ nmea = 3.01 packaging = mouse pps = True pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? rating = excellent submitter = Gary E. Miller , Tony Hain techdoc = http://www.usglobalsat.com/p-58-mr-350p-bulkhead.aspx @@ -1425,7 +1425,7 @@ firmware = 2.18 interfaces = RS-232 pps = True pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? model = FireFly-1A and FireFly-II GPSDO notes = Uses uBlox Antaris 5 with Kick Start and Super Sense, soon movingto uBlox-6. Defective \r\r\n string terminations @@ -1530,7 +1530,7 @@ tested = regression rating = good pps = True pps_accuracy = 250ns -ntp_offset = ? +time_offset = ? submitter = Chris Kuethe notes = Receiver comes up in silent mode, you may need to use ashctl to turn on a default set of messages. Tested with firmware BQ00 and BQ04. @@ -1565,7 +1565,7 @@ tested = 2.20 nmea = 2.2 pps = True pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? rating = good discontinued = True submitter = Wojciech Kazubski @@ -1612,7 +1612,7 @@ interfaces = USB tested = 3.9 pps = True pps_accuracy = 1ms -ntp_offset = ? +time_offset = ? rating = excellent submitter = Eric S. Raymond . notes = Also known as the Macx-1, this is the USB variant of the @@ -2266,7 +2266,7 @@ engine = Colossus RF ASIC, IO-C33 (Epson C33 RISC) interfaces = USB,RS-232 pps = True pps_accuracy = 50ns -ntp_offset = 0.675s +time_offset = 0.675s usbchip = CP2102 tested = regression rating = good @@ -2332,7 +2332,7 @@ interfaces = USB,UART tested = regression pps = True pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? submitter = Chris Kuethe [EVK-5H-0] @@ -2355,7 +2355,7 @@ date = 2011-02-02 interfaces = TTL pps = True pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? location = Adelaide, AU, 34.9S, 138.6E model = LEA 5Q notes = Sample contains GPGST (pseudorange noise statistics). @@ -2379,7 +2379,7 @@ model = EVK-6H-0 packaging = other rating = excellent pps_accuracy = 50ns -ntp_offset = ? +time_offset = ? submitter = Eric S. Raymond techdoc = http://www.u-blox.com/images/downloads/Product_Docs/u-blox6_ReceiverDescriptionProtocolSpec_%28GPS.G6-SW-10018%29.pdf vendor = uBlox diff --git a/gpscap.py b/gpscap.py index b00f46c7..423cea17 100644 --- a/gpscap.py +++ b/gpscap.py @@ -139,13 +139,13 @@ class GPSDictionary(ConfigParser.RawConfigParser): nmea = self.get(dev, "nmea") ofp.write("%s\n" % nmea) if self.has_option(dev, "pps") and self.get(dev, "pps") == "True": - pps_accuracy = ntp_offset = "" + pps_accuracy = time_offset = "" if self.has_option(dev, "pps_accuracy"): pps_accuracy = self.get(dev, "pps_accuracy") - if self.has_option(dev, "ntp_offset"): - ntp_offset = self.get(dev, "ntp_offset") - if pps_accuracy and ntp_offset: - ofp.write("%s
%s\n" % (pps_accuracy, ntp_offset)) + if self.has_option(dev, "time_offset"): + time_offset = self.get(dev, "time_offset") + if pps_accuracy and time_offset: + ofp.write("%s
%s\n" % (pps_accuracy, time_offset)) else: ofp.write("?
\n") else: diff --git a/gpsd.c b/gpsd.c index ea680866..6c13d563 100644 --- a/gpsd.c +++ b/gpsd.c @@ -220,8 +220,8 @@ static void typelist(void) #if defined(DBUS_EXPORT_ENABLE) (void)printf("# DBUS export enabled\n"); #endif -#if defined(NTPSHM_ENABLE) - (void)printf("# NTPSHM for NTPd enabled.\n"); +#if defined(TIMEHINT_ENABLE) + (void)printf("# Time service features enabled.\n"); #endif #if defined(PPS_ENABLE) (void)printf("# PPS enabled.\n"); @@ -1536,10 +1536,10 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) //gpsd_report(context.debug, LOG_PROG, "NTP: Got one\n"); /* assume zero when there's no offset method */ if (device->device_type == NULL - || device->device_type->ntp_offset == NULL) + || device->device_type->time_offset == NULL) offset = 0.0; else - offset = device->device_type->ntp_offset(device); + offset = device->device_type->time_offset(device); (void)ntpshm_put(device, device->newdata.time, offset); device->last_fixtime = device->newdata.time; } diff --git a/gpsd.h-tail b/gpsd.h-tail index f555fda9..87c31386 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -83,6 +83,9 @@ typedef unsigned int speed_t; #if defined(TNT_ENABLE) || defined(OCEANSERVER_ENABLE) #define COMPASS_ENABLE #endif +#ifdef NTPSHM_ENABLE +#define TIMEHINT_ENABLE +#endif /* First, declarations for the packet layer... */ @@ -239,7 +242,7 @@ struct gps_context_t { double gps_tow; /* GPS time of week, actually 19 bits */ int century; /* for NMEA-only devices without ZDA */ int rollovers; /* rollovers since start of run */ -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE int leap_notify; /* notification state from subframe */ #define LEAP_NOWARNING 0x0 /* normal, no leap second warning */ #define LEAP_ADDSECOND 0x1 /* last minute of day has 60 seconds */ @@ -250,7 +253,7 @@ struct gps_context_t { * 'optimize' as 'dead code' the writes to SHM */ /*@reldef@*/volatile struct shmTime *shmTime[NTPSHMSEGS]; bool shmTimeInuse[NTPSHMSEGS]; -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ # ifdef PPS_ENABLE /*@null@*/ void (*pps_hook)(struct gps_device_t *, unsigned long, struct timespec *); @@ -348,9 +351,9 @@ struct gps_type_t { #ifdef CONTROLSEND_ENABLE /*@null@*/ssize_t (*control_send)(struct gps_device_t *session, char *buf, size_t buflen); #endif /* CONTROLSEND_ENABLE */ -#ifdef NTPSHM_ENABLE - /*@null@*/double (*ntp_offset)(struct gps_device_t *session); -#endif /* NTPSHM_ENABLE */ +#ifdef TIMEHINT_ENABLE + /*@null@*/double (*time_offset)(struct gps_device_t *session); +#endif /* TIMEHINT_ENABLE */ }; /* diff --git a/libgpsd_core.c b/libgpsd_core.c index 4a3a92e6..efc026d2 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -231,8 +231,10 @@ void gps_context_init(struct gps_context_t *context) .gps_tow = 0, .century = 0, .rollovers = 0, -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE .leap_notify = LEAP_NOWARNING, +#endif /* TIMEHINT_ENABLE */ +#ifdef NTPSHM_ENABLE .enable_ntpshm = false, .shmTime = {0}, .shmTimeInuse = {0}, diff --git a/subframe.c b/subframe.c index 25097428..eaf34779 100644 --- a/subframe.c +++ b/subframe.c @@ -728,7 +728,7 @@ gps_mask_t gpsd_interpret_subframe(struct gps_device_t *session, subp->sub4_18.leap, subp->sub4_18.WNlsf, subp->sub4_18.DN, subp->sub4_18.lsf); -#ifdef NTPSHM_ENABLE +#ifdef TIMEHINT_ENABLE /* IS-GPS-200 Revision E, paragraph 20.3.3.5.2.4 */ if (((session->context->gps_week % 256) == (unsigned short)subp->sub4_18.WNlsf) && /* notify the leap seconds correction in the end of current day */ @@ -742,7 +742,7 @@ gps_mask_t gpsd_interpret_subframe(struct gps_device_t *session, session->context->leap_notify = LEAP_NOWARNING; } else session->context->leap_notify = LEAP_NOWARNING; -#endif /* NTPSHM_ENABLE */ +#endif /* TIMEHINT_ENABLE */ session->context->leap_seconds = (int)subp->sub4_18.leap; session->context->valid |= LEAP_SECOND_VALID; diff --git a/www/writing-a-driver.xml b/www/writing-a-driver.xml index ab624354..91e751b4 100644 --- a/www/writing-a-driver.xml +++ b/www/writing-a-driver.xml @@ -14,6 +14,14 @@ + + 1.12 + 31 Oct 2013 + er + + Updated by esr; ntp_offset becomes time_offset + + 1.11 19 Jan 2011 @@ -745,11 +753,12 @@ possible, assemble your packet in gpsmon to display the control messages it sends for you. -.ntp_offset points to code to compute -an offset to be added, additionally to that in -ntp.conf (if any) when shipping time notifications -to NTP. If multiple sentences set TIME_IS, this will differ by -sentence type; it should differ by baud rare, as well. +.timr_offset points to code to +compute an offset to be added, additionally to that in +ntp.conf (if any) when shipping time +notifications to NTP, or the equivalent configuration file for +chrony. If multiple sentences set TIME_IS, this will differ by +sentence type; it should differ by baud rate, as well. -- cgit v1.2.1