summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-05-24 10:14:19 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-05-24 10:14:19 +0000
commit922ac3d7d0a41a9ba91d3f3a359742fe21206844 (patch)
tree64a51af4798993ab3443782a88eb6394ee65f278 /packet.c
parente8a108fc351ac34f32385ed3018f4e036b4a5a0b (diff)
downloadgpsd-922ac3d7d0a41a9ba91d3f3a359742fe21206844.tar.gz
Fix error in TSIP state machine.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/packet.c b/packet.c
index cf8c95c9..e15e0e05 100644
--- a/packet.c
+++ b/packet.c
@@ -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