diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2007-01-11 02:06:56 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2007-01-11 02:06:56 +0000 |
commit | 033735841667900a4646e3749f23149b08e6e61e (patch) | |
tree | f0512650ba8a27eb57501c28727a5d7afb8f5b90 /packet.c | |
parent | bf95b046a85dfc29c47fa85f8ec107767a6e42fd (diff) | |
download | gpsd-033735841667900a4646e3749f23149b08e6e61e.tar.gz |
Fix to a packet-sniffer bug handling $P..
Diego Berge sent me an example of some line noise which just happened to have
$P<garbage> in it. This tricked the packet sniffer into thinking it found an
NMEA device. This change means that now 2 letters are required after the '$'
to trigger a detect. If this still false-positives too much, I might crank it
up to 4, to match on $PFec, $PFST, $PUBX, $PSRF and the like.
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -178,7 +178,7 @@ static void nextstate(struct gps_packet_t *lexer, if (c == 'G') lexer->state = NMEA_PUB_LEAD; else if (c == 'P') /* vendor sentence */ - lexer->state = NMEA_LEADER_END; + lexer->state = NMEA_VENDOR_LEAD; else if (c =='I') /* Seatalk */ lexer->state = SEATALK_LEAD_1; else if (c =='A') /* SiRF Ack */ @@ -192,6 +192,12 @@ static void nextstate(struct gps_packet_t *lexer, else lexer->state = GROUND_STATE; break; + case NMEA_VENDOR_LEAD: + if (isalpha(c)) + lexer->state = NMEA_LEADER_END; + else + lexer->state = GROUND_STATE; + break; #ifdef TNT_ENABLE case TNT_LEADER: lexer->state = NMEA_LEADER_END; |