diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-17 09:36:34 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-17 09:36:34 -0500 |
commit | 102f05a4e93d592386b40974bea0b3f5a8d648da (patch) | |
tree | fd1b1da79910114c821217d8eda5039c7cbabe0c | |
parent | a7c3cf50d4533fd1d01be4dffcdaaffb9a9d1ac8 (diff) | |
download | gpsd-102f05a4e93d592386b40974bea0b3f5a8d648da.tar.gz |
Fix up the pps=no build. All regression tests pass.
-rw-r--r-- | gps.h | 3 | ||||
-rw-r--r-- | gpsmon.c | 6 | ||||
-rw-r--r-- | libgps_json.c | 4 |
3 files changed, 12 insertions, 1 deletions
@@ -2048,6 +2048,9 @@ extern int gps_mainloop(struct gps_data_t *, int, extern const char /*@null observer@*/ *gps_data(const struct gps_data_t *); extern const char /*@observer@*/ *gps_errstr(const int); +int json_pps_read(const char *buf, struct gps_data_t *, + /*@null@*/ const char **); + /* dependencies on struct gpsdata_t end hrere */ extern void libgps_trace(int errlevel, const char *, ...); @@ -669,6 +669,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) { char buf[BUFSIZ]; +#ifdef PPS_ENABLE if (!serial && strncmp((char*)device->packet.outbuffer, "{\"class\":\"PPS\",", 13) == 0) { const char *end; @@ -687,6 +688,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) } } else +#endif /* PPS_ENABLE */ { (void)snprintf(buf, sizeof(buf), "(%d) ", (int)device->packet.outbuflen); @@ -1235,7 +1237,9 @@ int main(int argc, char **argv) int st = read(0, &inbuf, 1); if (st == 1) { +#ifdef PPS_ENABLE gpsd_acquire_reporting_lock(); +#endif /* PPS_ENABLE*/ tcflush(0, TCIFLUSH); tcsetattr(0, TCSANOW, &cooked); (void)fputs("gpsmon> ", stdout); @@ -1249,7 +1253,9 @@ int main(int argc, char **argv) if (!curses_active) { sleep(2); tcsetattr(0, TCSANOW, &rare); +#ifdef PPS_ENABLE gpsd_release_reporting_lock(); +#endif /* PPS_ENABLE*/ } } } diff --git a/libgps_json.c b/libgps_json.c index 8534dea5..065e71a5 100644 --- a/libgps_json.c +++ b/libgps_json.c @@ -353,7 +353,7 @@ static int json_error_read(const char *buf, struct gps_data_t *gpsdata, return status; } -static int json_pps_read(const char *buf, struct gps_data_t *gpsdata, +int json_pps_read(const char *buf, struct gps_data_t *gpsdata, /*@null@*/ const char **endptr) { int real_sec = 0, real_nsec = 0, clock_sec = 0, clock_nsec = 0; @@ -361,6 +361,8 @@ static int json_pps_read(const char *buf, struct gps_data_t *gpsdata, const struct json_attr_t json_attrs_pps[] = { /* *INDENT-OFF* */ {"class", t_check, .dflt.check = "PPS"}, + {"device", t_string, .addr.string = gpsdata->dev.path, + .len = sizeof(gpsdata->dev.path)}, {"real_sec", t_integer, .addr.integer = &real_sec, .dflt.integer = 0}, {"real_nsec", t_integer, .addr.integer = &real_nsec, |