diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-05-24 10:14:19 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-05-24 10:14:19 +0000 |
commit | 922ac3d7d0a41a9ba91d3f3a359742fe21206844 (patch) | |
tree | 64a51af4798993ab3443782a88eb6394ee65f278 /packet.c | |
parent | e8a108fc351ac34f32385ed3018f4e036b4a5a0b (diff) | |
download | gpsd-922ac3d7d0a41a9ba91d3f3a359742fe21206844.tar.gz |
Fix error in TSIP state machine.
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -335,8 +335,18 @@ static void nexstate(struct gps_device_t *session, unsigned char c) session->packet_state = TSIP_DLE; break; case TSIP_DLE: - if (c == 0x03) + switch (c) + { + case 0x03: session->packet_state = TSIP_RECOGNIZED; + break; + case 0x10: + session->packet_state = TSIP_PAYLOAD; + break; + default: + session->packet_state = GROUND_STATE; + break; + } break; case TSIP_RECOGNIZED: if (c == 0x10) @@ -565,7 +575,7 @@ int packet_get(struct gps_device_t *session, unsigned int waiting) #ifdef TSIP_ENABLE } else if (session->packet_state == TSIP_RECOGNIZED) { int len = session->inbufptr - session->inbuffer; - if (len >= 4 && len < 80) { /* this needs more work */ + if (len >= 4 && len < MAX_PACKET_LENGTH) { session->packet_type = TSIP_PACKET; packet_accept(session); } else |