summaryrefslogtreecommitdiff
path: root/driver_nmea0183.c
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-04-20 20:01:03 -0700
committerFred Wright <fw@fwright.net>2016-04-21 15:32:09 -0700
commit387431a8f84d009444f66195e3327662714143d6 (patch)
treef55e2a2a6439e48300341d9b38eb99dc8b9352ec /driver_nmea0183.c
parent1a82f23ce925d509a190b5f98ffaaaee3659d163 (diff)
downloadgpsd-387431a8f84d009444f66195e3327662714143d6.tar.gz
Fixes phantom satellites from xxGSVs with a real signal ID.
The change to permit the new signal ID in the GSV sentences broke the loop end test, causing an extra "satellite" to be processed when the signal ID is present. The signal ID itself is misinterpreted as a satellite ID, with the other three values coming from indexing off the end of the buffer (typically getting zeroes). For receivers (incorrectly) reporting a signal ID of zero, this would typically get filtered out by the zero-ID filter (but not in non-GPS cases prior to fixing another bug), so it often didn't matter. But for receivers reporting a value of 1 (L1 C/A), this resulted in multiple phantom satellites with "PRN" 1. If the real PRN 1 was in use, it also screwed up the "active" count. The fix is just to round the field count down to a multiple of 4 prior to using it as the loop's end test. Also removes an incorrect comment about there being no more than three GSV sentences in a group. TESTED: Ran "scons build-all check". Also verified that, with the Navika receiver that reports the signal ID as 1, gpsmon and xgps no longer report phantom PRN 1 satellites, and cgps no longer misbehaves in some other (uninvestigated) way due to the confusion.
Diffstat (limited to 'driver_nmea0183.c')
-rw-r--r--driver_nmea0183.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c
index 5305806a..80944e63 100644
--- a/driver_nmea0183.c
+++ b/driver_nmea0183.c
@@ -681,7 +681,6 @@ static gps_mask_t processGSV(int count, char *field[],
* 083 Azimuth, degrees
* 46 Signal-to-noise ratio in decibels
* <repeat for up to 4 satellites per sentence>
- * There my be up to three GSV sentences in a data packet
*
* Can occur with talker IDs:
* BD (Beidou),
@@ -764,7 +763,7 @@ static gps_mask_t processGSV(int count, char *field[],
session->nmea.seen_qzss = true;
}
- for (fldnum = 4; fldnum < count;) {
+ for (fldnum = 4; fldnum < count / 4 * 4;) {
struct satellite_t *sp;
if (session->gpsdata.satellites_visible >= MAXCHANNELS) {
gpsd_log(&session->context->errout, LOG_ERROR,