diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-04-11 14:18:38 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-04-11 14:18:38 +0000 |
commit | c691de9da0fb4f2f03c5b90208fba659c10e574b (patch) | |
tree | 5c36512a8bbc9aeb5fab5ff2cf7fa0ca48f4bc80 /nmea_parse.c | |
parent | 56357a1751fc56da894e400f456c5bd9ea6ffc43 (diff) | |
download | gpsd-c691de9da0fb4f2f03c5b90208fba659c10e574b.tar.gz |
Interpret satellite counts more carefully.
Incrementing the satellite count unconditionally falls afoul of
chipsets like the Motorola Oncore GT+ that emit empty fields at
the end of the last sentence in a GPGSV set if the number of
satellites is not a multiiple of 4.
Diffstat (limited to 'nmea_parse.c')
-rw-r--r-- | nmea_parse.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nmea_parse.c b/nmea_parse.c index 1d9322cf..b7f217e2 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -348,11 +348,19 @@ static int processGPGSV(int count, char *field[], struct gps_data_t *out) else if (out->part == 1) gpsd_zero_satellites(out); - for (fldnum = 4; fldnum < count; out->satellites++) { + for (fldnum = 4; fldnum < count; ) { out->PRN[out->satellites] = atoi(field[fldnum++]); out->elevation[out->satellites] = atoi(field[fldnum++]); out->azimuth[out->satellites] = atoi(field[fldnum++]); out->ss[out->satellites] = atoi(field[fldnum++]); + /* + * Incrementing this unconditionally falls afoul of chipsets like + * the Motorola Oncore GT+ that emit empty fields at the end of the + * last sentence in a GPGSV set if the number of satellites is not + * a multiiple of 4. + */ + if (out->PRN[out->satellites]) + out->satellites++; } if (out->part == out->await && atoi(field[3]) != out->satellites) gpsd_report(0, "GPGSV field 3 value of %d != actual count %d\n", |