From 59d0330b70e0364b7ffb1bc37df8b341cdda75e5 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Fri, 12 Apr 2019 19:38:35 -0700 Subject: 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. --- driver_ubx.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'driver_ubx.c') 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 -#include #include -#include #include +#include +#include +#include +#include #include + #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, -- cgit v1.2.1