diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-04 05:58:38 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-04 05:58:38 +0000 |
commit | f3c48afdefec746cbef1c445fdf7cce132fe563a (patch) | |
tree | 905ab906ef4e963de8b358e518c275eaccc22011 /packet.c | |
parent | d18c64194d53e5e074f84fca1463b1e37532830e (diff) | |
download | gpsd-f3c48afdefec746cbef1c445fdf7cce132fe563a.tar.gz |
how could i have possibly screwed up superstar2 detection so badly?
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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: |