From 41d348111305af41b0ada5512fd6593314c429a2 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 13 Jun 2010 18:34:13 -0400 Subject: Add code to recover from false lock to Garmin Simple Text mode. That is, if we later see NMEA or some other packet type. It's easy to get a false lock from line noise because this format is not checksummed. --- drivers.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'drivers.c') diff --git a/drivers.c b/drivers.c index ad3e51ca..1e32b90f 100644 --- a/drivers.c +++ b/drivers.c @@ -901,8 +901,24 @@ static const struct gps_type_t rtcm104v3 = { static gps_mask_t garmintxt_parse_input(struct gps_device_t *session) { - //gpsd_report(LOG_PROG, "Garmin Simple Text packet\n"); - return garmintxt_parse(session); + if (session->packet.type == COMMENT_PACKET) { + return 0; + } else if (session->packet.type == GARMINTXT_PACKET) { + //gpsd_report(LOG_PROG, "Garmin Simple Text packet\n"); + return garmintxt_parse(session); + } else { + const struct gps_type_t **dp; + + for (dp = gpsd_drivers; *dp; dp++) { + if (session->packet.type == (*dp)->packet_type) { + gpsd_report(LOG_WARN, "%s packet seen when NMEA expected.\n", + (*dp)->type_name); + (void)gpsd_switch_driver(session, (*dp)->type_name); + return (*dp)->parse_packet(session); + } + } + return 0; + } } /* *INDENT-OFF* */ -- cgit v1.2.1