diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-03-06 13:07:43 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-03-06 13:07:43 +0000 |
commit | b00632ab81f8532200a69f79fbb9b369ae3302ad (patch) | |
tree | aaf5556888672e3e30bb9b81b2811c68edad5cd4 /driver_zodiac.c | |
parent | fa63e809a527cbfb13ab8e0fe9a08543e508c261 (diff) | |
download | gpsd-b00632ab81f8532200a69f79fbb9b369ae3302ad.tar.gz |
Simplify the way ALLOW_RECONFIGURE works.
It now conditions out the speed-switcher, mode-switcher, and
rate-switcher methods of the driver structure entirely. This makes it
possible to condition out whole functions (rather than small bits that
do device writes) almost everywhere. Build tested with
ALLOW_RECONFIGURE off.
This improvement should make the embedded people happy.
Diffstat (limited to 'driver_zodiac.c')
-rw-r--r-- | driver_zodiac.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/driver_zodiac.c b/driver_zodiac.c index 4afcc211..6db86ab9 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -67,7 +67,6 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, un h.flags = 0; h.csum = zodiac_checksum((unsigned short *) &h, 4); -#ifdef ALLOW_RECONFIGURE if (session->gpsdata.gps_fd != -1) { size_t hlen, datlen; hlen = sizeof(h); @@ -78,7 +77,6 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, un return -1; } } -#endif /* ALLOW_RECONFIGURE */ (void)snprintf(buf, sizeof(buf), "%04x %04x %04x %04x %04x", @@ -92,6 +90,7 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, un return 0; } +#ifdef ALLOW_RECONFIGURE static bool zodiac_speed_switch(struct gps_device_t *session, speed_t speed, char parity, int stopbits) { @@ -127,12 +126,9 @@ static bool zodiac_speed_switch(struct gps_device_t *session, data[14] = zodiac_checksum(data, 14); (void)zodiac_spew(session, 1330, data, 15); -#ifdef ALLOW_RECONFIGURE return true; /* it would be nice to error-check this */ -#else - return false; -#endif /* ALLOW_RECONFIGURE */ } +#endif /* ALLOW_RECONFIGURE */ static ssize_t zodiac_control_send(struct gps_device_t *session, char *msg, size_t len) @@ -476,17 +472,15 @@ const struct gps_type_t zodiac_binary = .probe_wakeup = NULL, /* no probe on baud rate change */ .probe_detect = NULL, /* no probe */ .probe_subtype = NULL, /* no initialization */ -#ifdef ALLOW_RECONFIGURE - .configurator = NULL, /* no configuration */ -#endif /* ALLOW_RECONFIGURE */ .get_packet = generic_get, /* use the generic packet getter */ .parse_packet = zodiac_analyze, /* parse message packets */ .rtcm_writer = zodiac_send_rtcm, /* send DGPS correction */ +#ifdef ALLOW_RECONFIGURE + .configurator = NULL, /* no configuration */ .speed_switcher = zodiac_speed_switch,/* we can change baud rate */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ .cycle_chars = -1, /* not relevant, no rate switch */ -#ifdef ALLOW_RECONFIGURE .revert = NULL, /* no reversion hook */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* caller might supply a close hook */ |