summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2009-07-04 05:58:38 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2009-07-04 05:58:38 +0000
commitf3c48afdefec746cbef1c445fdf7cce132fe563a (patch)
tree905ab906ef4e963de8b358e518c275eaccc22011 /packet.c
parentd18c64194d53e5e074f84fca1463b1e37532830e (diff)
downloadgpsd-f3c48afdefec746cbef1c445fdf7cce132fe563a.tar.gz
how could i have possibly screwed up superstar2 detection so badly?
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/packet.c b/packet.c
index 85a92c94..ef13624e 100644
--- a/packet.c
+++ b/packet.c
@@ -516,17 +516,20 @@ static void nextstate(struct gps_packet_t *lexer,
lexer->state = GROUND_STATE;
break;
case SUPERSTAR2_ID2:
- lexer->length = (size_t)c + 4;
- if (lexer->length <= MAX_PACKET_LENGTH)
+ lexer->length = (size_t)c; /* how many data bytes follow this byte */
+ if (lexer->length)
lexer->state = SUPERSTAR2_PAYLOAD;
else
- lexer->state = GROUND_STATE;
+ lexer->state = SUPERSTAR2_CKSUM1; /* no data, jump to checksum */
break;
case SUPERSTAR2_PAYLOAD:
if (--lexer->length == 0)
lexer->state = SUPERSTAR2_CKSUM1;
break;
case SUPERSTAR2_CKSUM1:
+ lexer->state = SUPERSTAR2_CKSUM2;
+ break;
+ case SUPERSTAR2_CKSUM2:
lexer->state = SUPERSTAR2_RECOGNIZED;
break;
case SUPERSTAR2_RECOGNIZED: