summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorAhti Heinla <ahti@ahti.bluemoon.ee>2015-01-08 14:34:54 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-01-08 14:34:54 -0500
commit2ab876371ec089b7529301beb0f424fe6196b81a (patch)
tree785df97859995145e112ac971d4cb59493c64a53 /packet.c
parentf2cd74637bbe156a11acad627386154d67b89115 (diff)
downloadgpsd-2ab876371ec089b7529301beb0f424fe6196b81a.tar.gz
Fix RTCM2 detection in packet.c
Regression tests pass. Author's notes: RTCM2 support seems to be practically broken, if the stream frequently includes the 0x40 byte. This byte causes packet.c to temporarily think it is an AT1 stream, and stop calling rtcm2_decode() while it thinks so. I have an RTCM stream from station id 0, and this particular station ID causes the 0x40 byte to appear in virtually every RTCM message, so for that stream, I have to wait through hundreds of RTCM messages before it is positively identified and RTCM decoding starts to work. Patch attached, works for me.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/packet.c b/packet.c
index d5220fdf..7a5d89ef 100644
--- a/packet.c
+++ b/packet.c
@@ -224,6 +224,12 @@ static void nextstate(struct gps_lexer_t *lexer, unsigned char c)
#endif /* NMEA_ENABLE */
#if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) || defined(ONCORE_ENABLE)
if (c == '@') {
+#ifdef RTCM104V2_ENABLE
+ if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
+ lexer->state = RTCM2_RECOGNIZED;
+ break;
+ }
+#endif /* RTCM104V2_ENABLE */
lexer->state = AT1_LEADER;
break;
}