summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-03-07 14:10:45 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-03-07 14:10:45 +0000
commitabeb84381e32b4795b670b8b68ba61c5cf189ef3 (patch)
treed7895480b56c42597096b9bcd233155c0e3c8244 /libgpsd_core.c
parent45238dc94b0a807a17aff9949640e7254e37b8d6 (diff)
downloadgpsd-abeb84381e32b4795b670b8b68ba61c5cf189ef3.tar.gz
Remove 'cycle' member from device structure.
It was only ever being set to constant 1. Instead, we keep the current cycle in gpsdata and initialize it in gpsd_init(). This makes no behavioral changes, but clears the decks for better handling of rate switchers.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a0f88473..4cbae854 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -47,8 +47,6 @@ int gpsd_switch_driver(struct gps_device_t *session, char* type_name)
gpsd_report(LOG_PROG, "selecting %s driver...\n", (*dp)->type_name);
gpsd_assert_sync(session);
/*@i@*/session->device_type = *dp;
- if (session->cycle <= 0)
- session->cycle = (*dp)->cycle;
if (!session->context->readonly && session->device_type->probe_subtype != NULL)
session->device_type->probe_subtype(session, session->packet.counter = 0);
#ifdef ALLOW_RECONFIGURE
@@ -89,6 +87,7 @@ void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, char
session->gpsdata.gdop = NAN;
session->gpsdata.epe = NAN;
session->mag_var = NAN;
+ session->gpsdata.cycle = session->gpsdata.mincycle = 1;
/* tty-level initialization */
gpsd_tty_init(session);
@@ -778,7 +777,8 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
session->gpsdata.online = 0;
return 0;
} else if (newlen == 0) { /* no new data */
- if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->device_type->cycle+1){
+ if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->gpsdata.
+cycle+1){
gpsd_report(LOG_INF, "GPS on %s is offline (%lf sec since data)\n",
session->gpsdata.gps_device,
timestamp() - session->gpsdata.online);