summaryrefslogtreecommitdiff
path: root/driver_ubx.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver_ubx.c')
-rw-r--r--driver_ubx.c18
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,