summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-10-31 19:45:05 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-10-31 19:45:05 +0000
commitadac953ea01392e50d915dd72e637819c9fff0e9 (patch)
tree432c64e71c375d970ea2924dc23e41a96be5aebf
parente5fd5732bd5655ad01ab483267aa48589228766b (diff)
downloadgpsd-adac953ea01392e50d915dd72e637819c9fff0e9.tar.gz
Enable clients to display the GPS type.
-rw-r--r--gpsd.c8
-rw-r--r--gpsd.h1
-rw-r--r--sirf.c1
3 files changed, 8 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 5b96236b..b0f7e87d 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -761,10 +761,14 @@ static int handle_gpsd_request(struct subscriber_t* sub, char *buf, int buflen)
(void)snprintf(phrase, sizeof(phrase), ",G=GPS");
break;
case 'I':
- if (assign_channel(sub) && sub->device->device_type!=NULL)
+ if (assign_channel(sub) && sub->device->device_type!=NULL) {
(void)snprintf(phrase, sizeof(phrase), ",I=%s",
sub->device->device_type->typename);
- else
+ if (sub->device->subtype[0]) {
+ (void)strlcat(phrase, " ", sizeof(phrase));
+ (void)strlcat(phrase, sub->device->subtype, sizeof(phrase));
+ }
+ } else
(void)strlcpy(phrase, ",I=?", BUFSIZ);
break;
case 'J':
diff --git a/gpsd.h b/gpsd.h
index 18f13df2..2c16d1a2 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -149,6 +149,7 @@ struct gps_device_t {
size_t outbuflen;
unsigned long char_counter; /* count characters processed */
unsigned long retry_counter; /* count sniff retries */
+ char subtype[32]; /* firmware version or subtype ID */
double poll_times[FD_SETSIZE]; /* last daemon poll time */
#ifdef NTPSHM_ENABLE
int shmindex;
diff --git a/sirf.c b/sirf.c
index 3053224c..ec6efdeb 100644
--- a/sirf.c
+++ b/sirf.c
@@ -269,6 +269,7 @@ gps_mask_t sirf_parse(struct gps_device_t *session, unsigned char *buf, size_t l
case 0x06: /* Software Version String */
gpsd_report(4, "FV 0x06: Firmware version: %s\n", buf+1);
+ (void)strlcpy(session->subtype, (char *)buf+1, sizeof(session->subtype));
fv = atof((char *)(buf+1));
if (fv < 231) {
session->driver.sirf.driverstate |= SIRF_LT_231;