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 ++++++++++++++---- gpsd.h | 4 ++++ 2 files changed, 18 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 -#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, diff --git a/gpsd.h b/gpsd.h index a9936c13..8f3c12b8 100644 --- a/gpsd.h +++ b/gpsd.h @@ -58,6 +58,7 @@ extern "C" { * Add cfg_stage and cfg_step, for initialization * Add oldfix2 for better oldfix * Make subtype longer + * Add ubx.protver, ubx.end_class, ubx.end_id to gps_device_t */ /* Keep in sync with api_major_version and api_minor gps/__init__.py */ #define GPSD_PROTO_MAJOR_VERSION 3 /* bump on incompatible changes */ @@ -699,6 +700,9 @@ struct gps_device_t { struct { unsigned char port_id; unsigned char sbas_in_use; + unsigned char protver; /* u-blox protocol version */ + unsigned char end_class; /* cycle ender class */ + unsigned char end_id; /* cycle ender ID */ } ubx; #endif /* UBLOX_ENABLE */ #ifdef NAVCOM_ENABLE -- cgit v1.2.1