summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd-3.23/0006-ubxtimelps.patch
blob: 6f92aea504224ffdea7f412cd2d492a49ccd93fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 830a414311ee287340b11b60f5c6bb58aad7074f Mon Sep 17 00:00:00 2001
From: Mykyta Dorokhin <mykyta.dorokhin@globallogic.com>
Date: Tue, 28 Dec 2021 15:35:38 +0200
Subject: [PATCH] Add missing leap seconds parts

---
 SConscript           |  1 +
 drivers/driver_ubx.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/SConscript b/SConscript
index 8c6136d..3ae2a7b 100644
--- a/SConscript
+++ b/SConscript
@@ -315,6 +315,7 @@ boolopts = (
     ("tripmate",      True,  "DeLorme TripMate support"),
     ("tsip",          True,  "Trimble TSIP support"),
     ("ublox",         True,  "u-blox Protocol support"),
+    ("ubloxtimels",   False, "u-blox UBX-NAV-TIMELS support (leap second)"),
     # Non-GPS protocols
     ("aivdm",         True,  "AIVDM support"),
     ("gpsclock",      True,  "GPSClock support"),
diff --git a/drivers/driver_ubx.c b/drivers/driver_ubx.c
index bea2de0..e9f8a1c 100644
--- a/drivers/driver_ubx.c
+++ b/drivers/driver_ubx.c
@@ -3798,7 +3798,10 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
         mask = ubx_msg_nav_timegps(session, &buf[UBX_PREFIX_LEN], data_len);
         break;
     case UBX_NAV_TIMELS:
+        GPSD_LOG(LOG_PROG, &session->context->errout, "UBX_NAV_TIMELS\n");
+#ifdef UBLOXTIMELS_ENABLE
         mask = ubx_msg_nav_timels(session, &buf[UBX_PREFIX_LEN], data_len);
+#endif // UBLOXTIMELS_ENABLE
         break;
     case UBX_NAV_TIMEQZSS:
         GPSD_LOG(LOG_PROG, &session->context->errout, "UBX-NAV-TIMEQZSS\n");
@@ -3853,6 +3856,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
         GPSD_LOG(LOG_PROG, &session->context->errout, "UBX-RXM-RTCM\n");
         break;
     case UBX_RXM_SFRB:
+        GPSD_LOG(LOG_DATA, &session->context->errout, "UBX_RXM_SFRB\n");
         mask = ubx_msg_rxm_sfrb(session, &buf[UBX_PREFIX_LEN], data_len);
         break;
     case UBX_RXM_SFRBX:
@@ -4267,6 +4271,14 @@ ubx_cfg_prt(struct gps_device_t *session, speed_t speed, const char parity,
             (void)ubx_write(session, UBX_CLASS_CFG, 0x01, msg, 3);
         }
 
+#ifdef UBLOXTIMELS_ENABLE
+        msg[0] = 0x01;		/* class */
+        msg[1] = 0x26;		/* msg id  = UBX_NAV_TIMELS */
+        msg[2] = 0xff;		/* rate */
+        (void)ubx_write(session, 0x06u, 0x01, msg, 3);
+#endif /* UBLOXTIMELS_ENABLE */
+
+
     } else { /* MODE_BINARY */
         // nmea to turn off
         const unsigned char nmea_off[] = {
@@ -4349,6 +4361,13 @@ ubx_cfg_prt(struct gps_device_t *session, speed_t speed, const char parity,
             (void)ubx_write(session, UBX_CLASS_CFG, 0x01, msg, 3);
         }
 
+#ifdef UBLOXTIMELS_ENABLE
+        msg[0] = 0x01;		/* class */
+        msg[1] = 0x26;		/* msg id  = UBX_NAV_TIMELS */
+        msg[2] = 0xff;		/* rate */
+        (void)ubx_write(session, 0x06u, 0x01, msg, 3);
+#endif /* UBLOXTIMELS_ENABLE */
+
         /* if protver unknown, turn on everything.  Which may be too
          * much for slower serial port speeds.  Hope that we know protver
          * later and can fix things then. */
-- 
2.25.1