diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-25 07:35:41 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-25 07:35:41 -0400 |
commit | 2f7a78002f012c7ed322767cf3e413b961a640b4 (patch) | |
tree | 50d95ee10f3a8e972489e5502a75dd970483a15f /driver_ubx.c | |
parent | 3517cd53afabac201b3563f58a33dc15fd35bfdd (diff) | |
download | gpsd-2f7a78002f012c7ed322767cf3e413b961a640b4.tar.gz |
Split firmwqre version query out of the init method.
This enables us to force readonly off while it's being called.
The practical effect is that gpsmon can get a firmware version (if this
is possible) without reconfiguring the device.
Diffstat (limited to 'driver_ubx.c')
-rw-r--r-- | driver_ubx.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/driver_ubx.c b/driver_ubx.c index 88633919..cf51afd0 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -619,6 +619,16 @@ static ssize_t ubx_control_send(struct gps_device_t *session, char *msg, } #endif /* CONTROLSEND_ENABLE */ +static void ubx_init_query(struct gps_device_t *session) +{ + unsigned char msg[32]; + + /*@ -type @*/ + /* MON_VER: query for version information */ + (void)ubx_write(session, UBX_CLASS_MON, 0x04, msg, 0); + /*@ +type @*/ +} + static void ubx_event_hook(struct gps_device_t *session, event_t event) { if (session->context->readonly) @@ -638,9 +648,6 @@ static void ubx_event_hook(struct gps_device_t *session, event_t event) msg[6] = 0x00; msg[7] = 0x00; (void)ubx_write(session, 0x06u, 0x16, msg, 8); - - /* MON_VER: query for version information */ - (void)ubx_write(session, UBX_CLASS_MON, 0x04, msg, 0); /*@ +type @*/ #ifdef RECONFIGURE_ENABLE @@ -969,6 +976,7 @@ const struct gps_type_t driver_ubx = { .get_packet = generic_get, /* Packet getter (using default routine) */ .parse_packet = parse_input, /* Parse message packets */ .rtcm_writer = gpsd_write, /* RTCM handler (using default routine) */ + .init_query = ubx_init_query, /* non-perturbing initial query */ .event_hook = ubx_event_hook, /* Fire on various lifetime events */ #ifdef RECONFIGURE_ENABLE .speed_switcher = ubx_speed, /* Speed (baudrate) switch */ |