diff options
author | Gary E. Miller <gem@rellim.com> | 2019-04-12 19:38:35 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-04-12 19:38:35 -0700 |
commit | 59d0330b70e0364b7ffb1bc37df8b341cdda75e5 (patch) | |
tree | cdcfa0435787e1060130474f5b80552d52bc1bf4 /driver_ubx.c | |
parent | 9c6c514fd751cfc35ca0fad388748d3e9fde7765 (diff) | |
download | gpsd-59d0330b70e0364b7ffb1bc37df8b341cdda75e5.tar.gz |
driver_ubx: Add ubx.protver, and more, to gps_device_t.
The protocol version will be needed for future configuration
operations. The cycle enders will be used soon.
Diffstat (limited to 'driver_ubx.c')
-rw-r--r-- | driver_ubx.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/driver_ubx.c b/driver_ubx.c index a6bac450..b9f424d4 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -19,13 +19,15 @@ * */ -#include <stdio.h> -#include <stdbool.h> #include <assert.h> -#include <string.h> #include <math.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <unistd.h> + #include "gpsd.h" #if defined(UBLOX_ENABLE) && defined(BINARY_ENABLE) #include "driver_ubx.h" @@ -102,6 +104,7 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, { size_t n = 0; /* extended info counter */ char obuf[128]; /* temp version string buffer */ + char *cptr; if (40 > data_len) { gpsd_log(&session->context->errout, LOG_WARN, @@ -109,7 +112,6 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, return; } - /* save SW and HW Version as subtype */ (void)snprintf(obuf, sizeof(obuf), "SW %.30s,HW %.10s", @@ -130,6 +132,14 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, } /* save what we can */ (void)strlcpy(session->subtype, obuf, sizeof(session->subtype)); + /* find PROTVER= */ + cptr = strstr(session->subtype, "PROTVER="); + if (NULL != cptr) { + int protver = atoi(cptr + 8); + if (9 < protver) { + session->driver.ubx.protver = protver; + } + } /* output SW and HW Version at LOG_INFO */ gpsd_log(&session->context->errout, LOG_INF, |