summaryrefslogtreecommitdiff
path: root/driver_tsip.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-25 07:35:41 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-25 07:35:41 -0400
commit2f7a78002f012c7ed322767cf3e413b961a640b4 (patch)
tree50d95ee10f3a8e972489e5502a75dd970483a15f /driver_tsip.c
parent3517cd53afabac201b3563f58a33dc15fd35bfdd (diff)
downloadgpsd-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_tsip.c')
-rw-r--r--driver_tsip.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/driver_tsip.c b/driver_tsip.c
index ea29145e..d8736736 100644
--- a/driver_tsip.c
+++ b/driver_tsip.c
@@ -1012,6 +1012,19 @@ static ssize_t tsip_control_send(struct gps_device_t *session,
}
#endif /* CONTROLSEND_ENABLE */
+static void tsip_init_query(struct gps_device_t *session)
+{
+ unsigned char buf[100];
+
+ /* Request Hardware Version Information */
+ putbyte(buf, 0, 0x03); /* Subcode */
+ (void)tsip_write(session, 0x1c, buf, 1);
+ /*
+ * After HW information packet is received, a
+ * decision is made how to configure the device.
+ */
+}
+
static void tsip_event_hook(struct gps_device_t *session, event_t event)
{
if (session->context->readonly)
@@ -1020,7 +1033,7 @@ static void tsip_event_hook(struct gps_device_t *session, event_t event)
unsigned char buf[100];
/*
- * Set basic configuration, in case no hardware config resonse
+ * Set basic configuration, in case no hardware config response
* comes back.
*/
putbyte(buf, 0, 0x1e); /* Position: DP, MSL, LLA */
@@ -1028,14 +1041,6 @@ static void tsip_event_hook(struct gps_device_t *session, event_t event)
putbyte(buf, 2, 0x00); /* Time: GPS */
putbyte(buf, 3, 0x08); /* Aux: dBHz */
(void)tsip_write(session, 0x35, buf, 4);
-
- /* Request Hardware Version Information */
- putbyte(buf, 0, 0x03); /* Subcode */
- (void)tsip_write(session, 0x1c, buf, 1);
- /*
- * After HW information packet is received, a
- * decision is made how to configure the device.
- */
}
if (event == event_configure && session->packet.counter == 0) {
/*
@@ -1256,6 +1261,7 @@ const struct gps_type_t driver_tsip =
.get_packet = generic_get, /* use the generic packet getter */
.parse_packet = tsip_parse_input, /* parse message packets */
.rtcm_writer = NULL, /* doesn't accept DGPS corrections */
+ .init_query = tsip_init_query, /* non-perturbing initial query */
.event_hook = tsip_event_hook, /* fire on various lifetime events */
#ifdef RECONFIGURE_ENABLE
.speed_switcher = tsip_speed_switch,/* change baud rate */