summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-02 18:09:32 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-02 18:11:22 -0500
commitb73abff012abacf770a9f59fb054b721e2b9e336 (patch)
treeef0fa6b7fcea597905e61bea9ea3403b01f9e151
parent7aed6d1d79289ac2bf15e4509d5f79a84b0dc177 (diff)
downloadgpsd-b73abff012abacf770a9f59fb054b721e2b9e336.tar.gz
Revert the change abolishing the "pps" policy flag, it broke gpsmon client mode.
All regression tests pass.
-rw-r--r--NEWS18
-rw-r--r--TODO2
-rw-r--r--gps.h1
-rw-r--r--gpsd.c11
-rw-r--r--gpsd_json.c5
-rw-r--r--gpsd_json.xml7
-rw-r--r--libgps_core.c3
-rw-r--r--shared_json.c1
-rw-r--r--test/clientlib/multipacket.log.chk2
9 files changed, 31 insertions, 19 deletions
diff --git a/NEWS b/NEWS
index 0907baa4..6eb4cfbc 100644
--- a/NEWS
+++ b/NEWS
@@ -4,18 +4,18 @@ Repository head:
Better protection against false matches of Inland AIS messages; this
required a libgps version bump to 22 (as a side effect, per-device
footprint has decreased). PPS feature is no longer marked
- experimental/unstable and the separate "pps" policy flag is gone;
- PPS is now always emitted when watching JSON. Sentence tag fields
- have been dropped from the JSON reports. GNSS and GLONASS SKY
- reports are now merged. Addressed versions of AIS Type 25 and 26 are now
+ experimental/unstable. Sentence tag fields have been dropped from
+ the JSON reports. GNSS and GLONASS SKY reports are now
+ merged. Addressed versions of AIS Type 25 and 26 are now
handled. The 'nmea' build option is now 'nmea0183'. New 'minimal'
option sets all boolean options not explicitly set on the command
line to false. The 'limited_max_devices' option is now
- 'max_devices'; the 'limited_max_clients' option is now
- 'max_clients' A bug fix for error modeling when NMEA 0183 reports
- empty DOP fields. Low-level I/O changes to prevent buzzing when select(2)
- is buggy and returns too fast; a side effect of this change reduces
- time-reporting latency, possibly requiring you to re-tune NTP fudges.
+ 'max_devices'; the 'limited_max_clients' option is now 'max_clients'
+ A bug fix for error modeling when NMEA 0183 reports empty DOP
+ fields. Low-level I/O changes to prevent buzzing when select(2) is
+ buggy and returns too fast; a side effect of this change reduces
+ time-reporting latency, possibly requiring you to re-tune NTP
+ fudges.
* Sat 23 Aug 2014 Eric S. Raymond <esr@snark.thyrsus.com> - 3.11
A bug that prevented track interpolation has been fixed.
diff --git a/TODO b/TODO
index 45ac0d39..6f35cc17 100644
--- a/TODO
+++ b/TODO
@@ -124,7 +124,7 @@ We caw now *really* measure latency from GPS top of second when it has
1PPS. Add this capability to gpsprof and revise the "Where's the
Latency?" white paper.
-*** Low-power autoconfiguration in the uBlox driver ***
+*** Low-pwer autoconfiguration in the uBlox driver ***
Anthony Stirk <upuaut@gmail.com> writes on Wed May 21 06:09:00 2014:
diff --git a/gps.h b/gps.h
index fbc7f1d7..6bf7c336 100644
--- a/gps.h
+++ b/gps.h
@@ -1878,6 +1878,7 @@ struct policy_t {
bool scaled; /* requesting report scaling? */
bool timing; /* requesting timing info */
bool split24; /* requesting split AIS Type 24s */
+ bool pps; /* requesting PPS in NMEA/raw modes */
int loglevel; /* requested log level of messages */
char devpath[GPS_PATH_MAX]; /* specific device to watch */
char remote[GPS_PATH_MAX]; /* ...if this was passthrough */
diff --git a/gpsd.c b/gpsd.c
index 3b451532..3d19ffff 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -626,6 +626,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf,
}
static void notify_watchers(struct gps_device_t *device,
+ bool onjson, bool onpps,
const char *sentence, ...)
/* notify all JSON-watching clients of a given device about an event */
{
@@ -639,7 +640,7 @@ static void notify_watchers(struct gps_device_t *device,
for (sub = subscribers; sub < subscribers + MAX_CLIENTS; sub++)
if (sub->active != 0 && subscribed(sub, device)) {
- if (sub->policy.json)
+ if ((onjson && sub->policy.json) || (onpps && sub->policy.pps))
(void)throttled_write(sub, buf, strlen(buf));
}
}
@@ -649,7 +650,7 @@ static void deactivate_device(struct gps_device_t *device)
/* deactivate device, but leave it in the pool (do not free it) */
{
#ifdef SOCKET_EXPORT_ENABLE
- notify_watchers(device,
+ notify_watchers(device, true, false,
"{\"class\":\"DEVICE\",\"path\":\"%s\",\"activated\":0}\r\n",
device->gpsdata.dev.path);
#endif /* SOCKET_EXPORT_ENABLE */
@@ -738,7 +739,7 @@ bool gpsd_add_device(const char *device_name, bool flag_nowait)
ret = open_device(devp);
}
#ifdef SOCKET_EXPORT_ENABLE
- notify_watchers(devp,
+ notify_watchers(devp, true, false,
"{\"class\":\"DEVICE\",\"path\":\"%s\",\"activated\":%lf}\r\n",
devp->gpsdata.dev.path, timestamp());
#endif /* SOCKET_EXPORT_ENABLE */
@@ -1460,7 +1461,7 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed)
{
char id2[GPS_JSON_RESPONSE_MAX];
json_device_dump(device, id2, sizeof(id2));
- notify_watchers(device, id2);
+ notify_watchers(device, true, false, id2);
}
}
#endif /* SOCKET_EXPORT_ENABLE */
@@ -1652,7 +1653,7 @@ static void ship_pps_drift_message(struct gps_device_t *session,
/* on PPS interrupt, ship a drift message to all clients */
{
/*@-type@*//* splint is confused about struct timespec */
- notify_watchers(session,
+ notify_watchers(session, true, true,
"{\"class\":\"PPS\",\"device\":\"%s\",\"real_sec\":%ld, \"real_nsec\":%ld,\"clock_sec\":%ld,\"clock_nsec\":%ld}\r\n",
session->gpsdata.dev.path,
td->real.tv_sec, td->real.tv_nsec,
diff --git a/gpsd_json.c b/gpsd_json.c
index 48c63664..6d54843f 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -363,14 +363,15 @@ void json_watch_dump(const struct policy_t *ccp,
{
/*@-compdef@*/
(void)snprintf(reply, replylen,
- "{\"class\":\"WATCH\",\"enable\":%s,\"json\":%s,\"nmea\":%s,\"raw\":%d,\"scaled\":%s,\"timing\":%s,\"split24\":%s,",
+ "{\"class\":\"WATCH\",\"enable\":%s,\"json\":%s,\"nmea\":%s,\"raw\":%d,\"scaled\":%s,\"timing\":%s,\"split24\":%s,\"pps\":%s,",
ccp->watcher ? "true" : "false",
ccp->json ? "true" : "false",
ccp->nmea ? "true" : "false",
ccp->raw,
ccp->scaled ? "true" : "false",
ccp->timing ? "true" : "false",
- ccp->split24 ? "true" : "false");
+ ccp->split24 ? "true" : "false",
+ ccp->pps ? "true" : "false");
if (ccp->devpath[0] != '\0')
str_appendf(reply, replylen, "\"device\":\"%s\",", ccp->devpath);
str_rstrip_char(reply, ',');
diff --git a/gpsd_json.xml b/gpsd_json.xml
index 52d518ea..ad2a61fd 100644
--- a/gpsd_json.xml
+++ b/gpsd_json.xml
@@ -983,6 +983,13 @@ object.</para>
false. Applies only to AIS reports.</entry>
</row>
<row>
+ <entry>pps</entry>
+ <entry>No</entry>
+ <entry>boolean</entry>
+ <entry>If true, emit a PPS JSON message when the device issues
+ 1PPS. Default is false.</entry>
+</row>
+<row>
<entry>device</entry>
<entry>No</entry>
<entry>string</entry>
diff --git a/libgps_core.c b/libgps_core.c
index b16902c1..637dd204 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -337,13 +337,14 @@ void libgps_dump_state(struct gps_data_t *collect)
collect->version.proto_minor);
if (collect->set & POLICY_SET)
(void)fprintf(debugfp,
- "POLICY: watcher=%s nmea=%s raw=%d scaled=%s timing=%s, split24=%s devpath=%s\n",
+ "POLICY: watcher=%s nmea=%s raw=%d scaled=%s timing=%s, split24=%s pps=%s, devpath=%s\n",
collect->policy.watcher ? "true" : "false",
collect->policy.nmea ? "true" : "false",
collect->policy.raw,
collect->policy.scaled ? "true" : "false",
collect->policy.timing ? "true" : "false",
collect->policy.split24 ? "true" : "false",
+ collect->policy.pps ? "true" : "false",
collect->policy.devpath);
if (collect->set & SATELLITE_SET) {
struct satellite_t *sp;
diff --git a/shared_json.c b/shared_json.c
index 2d8cb6f8..25b583fb 100644
--- a/shared_json.c
+++ b/shared_json.c
@@ -98,6 +98,7 @@ int json_watch_read(const char *buf,
{"scaled", t_boolean, .addr.boolean = &ccp->scaled},
{"timing", t_boolean, .addr.boolean = &ccp->timing},
{"split24", t_boolean, .addr.boolean = &ccp->split24},
+ {"pps", t_boolean, .addr.boolean = &ccp->pps},
{"device", t_string, .addr.string = ccp->devpath,
.len = sizeof(ccp->devpath)},
{"remote", t_string, .addr.string = ccp->remote,
diff --git a/test/clientlib/multipacket.log.chk b/test/clientlib/multipacket.log.chk
index 9c57fe6d..dbcd18c8 100644
--- a/test/clientlib/multipacket.log.chk
+++ b/test/clientlib/multipacket.log.chk
@@ -1,4 +1,4 @@
flags: (0x20100000) {DEVICELIST|POLICY}
-POLICY: watcher=true nmea=false raw=0 scaled=false timing=false, split24=false devpath=
+POLICY: watcher=true nmea=false raw=0 scaled=false timing=false, split24=false pps=false, devpath=
DEVICELIST:1 devices:
1: path='/dev/ttyS0' driver='SiRF binary'