diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2007-12-28 03:13:44 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2007-12-28 03:13:44 +0000 |
commit | 35515b0d8d0b4594b90d7b6cc9cca218e89ee824 (patch) | |
tree | a367a14d3a083772b3f90000c29338b60af74366 | |
parent | df59e120bc7ecc8e737857e0710d95fc6a68e4ce (diff) | |
download | gpsd-35515b0d8d0b4594b90d7b6cc9cca218e89ee824.tar.gz |
Backed out some recent changes that broke regression tests.
Specifically, the changes to sirf.c from ckuethe to stop
rAte-linmiting satellite messages (27 Dec 2007) and the changes to
packet.c and packet.states.h from ckuethe on 25 Dec 2007 to make the
packet sniffer 'a bit more picky'.
The packet-getter changes need to be re-implemented in a way
that doesn't break the RTCM regression test.
The SiRF changes will break the regression tests, and that's OK, but
they need to be committed along with a rebuild of the tests so
the tests pass after commit.
-rw-r--r-- | packet.c | 70 | ||||
-rw-r--r-- | packet_states.h | 20 | ||||
-rw-r--r-- | sirf.c | 26 |
3 files changed, 25 insertions, 91 deletions
@@ -96,7 +96,7 @@ static void nextstate(struct gps_packet_t *lexer, #endif /* NMEA_ENABLE */ #if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) if (c == '@') { - lexer->state = AT_LEADER; + lexer->state = TNT_LEADER; break; } #endif @@ -221,72 +221,10 @@ static void nextstate(struct gps_packet_t *lexer, lexer->state = GROUND_STATE; break; #if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) - case AT_LEADER: -#ifdef GARMINTXT_ENABLE - if (isdigit(c)) - lexer->state = GARMINTXT_NUM1; -#ifdef TNT_ENABLE - else -#endif /* TNT_ENABLE */ -#endif /* GARMINTXT_ENABLE */ -#ifdef TNT_ENABLE - if ((c == 'B') || (c == 'C') || (c == 'F') || - (c == 'I') || (c == 'W') || (c == 'X')) - lexer->state = TNT_CMDCHAR; - else - lexer->state = GROUND_STATE; -#endif /* TNT_ENABLE */ - break; -#ifdef GARMINTXT_ENABLE - case GARMINTXT_NUM1: - if (isdigit(c)) - lexer->state = GARMINTXT_NUM2; - else - lexer->state = GROUND_STATE; - break; - case GARMINTXT_NUM2: - if (isdigit(c)) - lexer->state = GARMINTXT_NUM3; - else - lexer->state = GROUND_STATE; - break; - case GARMINTXT_NUM3: - if (isdigit(c)) - lexer->state = GARMINTXT_NUM4; - else - lexer->state = GROUND_STATE; - break; - case GARMINTXT_NUM4: - if (isdigit(c)) - lexer->state = GARMINTXT_NUM5; - else - lexer->state = GROUND_STATE; + case TNT_LEADER: + lexer->state = NMEA_LEADER_END; break; - case GARMINTXT_NUM5: - if (isdigit(c)) - lexer->state = GARMINTXT_NUM6; - else - lexer->state = GROUND_STATE; - break; - case GARMINTXT_NUM6: - if (isdigit(c)) - lexer->state = GARMINTXT_RECOGNIZED; - else - lexer->state = GROUND_STATE; - break; -#endif /* GARMINTXT_ENABLE */ -#ifdef TNT_ENABLE - case TNT_CMDCHAR: - lexer->state = NMEA_LEADER_END; - break; -#endif /* TNT_ENABLE */ -#endif /* TNT_ENABLE || GARMINTXT_ENABLE */ -#ifdef GARMINTXT_ENABLE - case GARMINTXT_RECOGNIZED: /* FALLTHROUGH */ -#endif /* GARMINTXT_ENABLE */ -#ifdef TNT_ENABLE - case TNT_RECOGNIZED: /* FALLTHROUGH */ -#endif /* TNT_ENABLE */ +#endif case NMEA_LEADER_END: if (c == '\r') lexer->state = NMEA_CR; diff --git a/packet_states.h b/packet_states.h index 2bfe9c78..b3a0af95 100644 --- a/packet_states.h +++ b/packet_states.h @@ -65,26 +65,10 @@ #endif /* ZODIAC_ENABLE */ #if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) - AT_LEADER, /* saw True North status leader '@' */ - /* Garmin Simple Text starts with @ leader */ + TNT_LEADER, /* saw True North status leader '@' */ + /* Garmin Simple Text starts with @ leader */ #endif -#ifdef TNT_ENABLE - TNT_CMDCHAR, /* one of: B C F I W X */ - TNT_RECOGNIZED, -#endif - -#ifdef GARMINTXT_ENABLE - GARMINTXT_NUM1, /* Garmin Simple Text starts with a YYMMDD date */ - GARMINTXT_NUM2, /* Attempt to match that to reduce wrong sniffs */ - GARMINTXT_NUM3, - GARMINTXT_NUM4, - GARMINTXT_NUM5, - GARMINTXT_NUM6, - GARMINTXT_RECOGNIZED, -#endif - - #ifdef EVERMORE_ENABLE EVERMORE_LEADER_1, /* a DLE after having seen EverMore data */ EVERMORE_LEADER_2, /* seen opening STX of EverMore packet */ @@ -307,15 +307,29 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, unsigned char *b = gpstime_to_unix(getsw(buf, 1), getul(buf, 3)*1e-2) - session->context->leap_seconds; for (i = st = 0; i < SIRF_CHANNELS; i++) { int off = 8 + 15 * i; - session->gpsdata.PRN[i] = (int)getub(buf, off); - session->gpsdata.azimuth[i] = (int)(((unsigned)getub(buf, off+1)*3)/2.0); - session->gpsdata.elevation[i] = (int)((unsigned)getub(buf, off+2)/2.0); + bool good; + session->gpsdata.PRN[st] = (int)getub(buf, off); + session->gpsdata.azimuth[st] = (int)(((unsigned)getub(buf, off+1)*3)/2.0); + session->gpsdata.elevation[st] = (int)((unsigned)getub(buf, off+2)/2.0); cn = 0; for (j = 0; j < 10; j++) cn += (int)getub(buf, off+5+j); - session->gpsdata.ss[i] = cn/10; - st++; + session->gpsdata.ss[st] = cn/10; + good = session->gpsdata.PRN[st]!=0 && + session->gpsdata.azimuth[st]!=0 && + session->gpsdata.elevation[st]!=0; +#ifdef __UNUSED__ + gpsd_report(LOG_PROG, "PRN=%2d El=%3.2f Az=%3.2f ss=%3d stat=%04x %c\n", + getub(buf, off), + getub(buf, off+2)/2.0, + (getub(buf, off+1)*3)/2.0, + cn/10, + getuw(buf, off+3), + good ? '*' : ' '); +#endif /* UNUSED */ + if (good!=0) + st += 1; } session->gpsdata.satellites = st; #ifdef NTPSHM_ENABLE @@ -328,7 +342,6 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, unsigned char *b (void)ntpshm_put(session,session->gpsdata.sentence_time+0.8); } #endif /* NTPSHM_ENABLE */ -#ifdef PLEASE_THROW_AWAY_USEFUL_DATA /* * The freaking brain-dead SiRF chip doesn't obey its own * rate-control command for 04, at least at firmware rev. 231, @@ -338,7 +351,6 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, unsigned char *b if ((session->driver.sirf.satcounter++ % 5) != 0) return 0; else -#endif return TIME_SET | SATELLITE_SET; } |