summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-05 12:24:25 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-05 12:24:25 -0400
commitf1d0dea4ce72f8e49eefcec94c2daf325358d809 (patch)
tree90dcc79d0ea8cfe5e3695850b46441bb7a93f095
parent386841833f71bee00c8a8f1cbab4b91622964b41 (diff)
downloadgpsd-f1d0dea4ce72f8e49eefcec94c2daf325358d809.tar.gz
Document the data-management problem underlying ckuethe's POLL bug.
All regression tests pass.
-rw-r--r--gpsd.c7
-rw-r--r--libgpsd_core.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index 0220333e..81025a70 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1104,6 +1104,13 @@ static void handle_request(struct subscriber_t *sub,
for (devp = devices; devp < devices + MAXDEVICES; devp++) {
if (allocated_device(devp) && subscribed(sub, devp)) {
if ((devp->observed & GPS_TYPEMASK)!=0) {
+ /*
+ * Architectural problem: This is going to see just the
+ * data dropped in during the last gps_poll() call.
+ * What we really need to do is have the drivers put
+ * new data someplace other than devp->gpsdata.fix, so
+ * that it can be returned to use for accumulated fix data.
+ */
json_tpv_dump(&devp->gpsdata,
reply + strlen(reply),
replylen - strlen(reply));
diff --git a/libgpsd_core.c b/libgpsd_core.c
index abb7215f..f38f14c2 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -580,6 +580,13 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
ssize_t newlen;
bool first_sync = false;
+ /*
+ * This looks strange, but it works because the
+ * gpsdata.fix buffer has been pressed into service
+ * as a place for the drivers to drop new data.
+ * The last accumulated fix actually lives in
+ * fixbuffer now. This should probably be fixed.
+ */
gps_clear_fix(&session->gpsdata.fix);
#ifdef TIMING_ENABLE