diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-13 09:03:35 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-13 09:03:35 +0000 |
commit | cd419e26ba8bfda8ba3fa8193a792bf2b4f35e44 (patch) | |
tree | 124e2d17cbaa9c1d0cdeb6a5b04f056bf34610fc /driver_tsip.c | |
parent | 00cd07ffcaa670709bc492e01d5c97be0262580b (diff) | |
download | gpsd-cd419e26ba8bfda8ba3fa8193a792bf2b4f35e44.tar.gz |
The configurator member becomes event_hook.
Code that referenced the sequence number argument now looks at
session->packet_counter directly.
This was almost a pure refactoring step. I added one obviously
missing session->packet.counter == 0 test in the oncore driver.
Despite temptation, I didn't try to fix when the packet.counter
gets zeroed; I'm going to try to confine the behavior changes
to one concise patch, which hasn't happened yet.
Codebase splints clean. All regression tests pass.
Diffstat (limited to 'driver_tsip.c')
-rw-r--r-- | driver_tsip.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/driver_tsip.c b/driver_tsip.c index a6275338..dba8c617 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -763,11 +763,9 @@ static ssize_t tsip_control_send(struct gps_device_t *session, #endif /* ALLOW_CONTROLSEND */ #ifdef ALLOW_RECONFIGURE -static void tsip_configurator(struct gps_device_t *session, - event_t event, - unsigned int seq) +static void tsip_event_hook(struct gps_device_t *session, event_t event) { - if (event == event_configure && seq == 0) { + if (event == event_configure && session->packet.counter == 0) { unsigned char buf[100]; /* I/O Options */ @@ -777,10 +775,10 @@ static void tsip_configurator(struct gps_device_t *session, putbyte(buf,3,0x08); /* Aux: dBHz */ (void)tsip_write(session, 0x35, buf, 4); } - if (event == event_probe_subtype && seq == 0) { + if (event == event_probe_subtype) { unsigned char buf[100]; - switch (seq) { + switch (session->packet.counter) { case 0: /* * TSIP is ODD parity 1 stopbit, save original values and @@ -911,7 +909,7 @@ const struct gps_type_t tsip_binary = .control_send = tsip_control_send,/* how to send commands */ #endif /* ALLOW_CONTROLSEND */ #ifdef ALLOW_RECONFIGURE - .configurator = tsip_configurator,/* initial mode sets */ + .event_hook = tsip_event_hook, /* initial mode sets */ .speed_switcher = tsip_speed_switch,/* change baud rate */ .mode_switcher = tsip_mode, /* there is a mode switcher */ .rate_switcher = NULL, /* no rate switcher */ |