summaryrefslogtreecommitdiff
path: root/libgps.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-05-18 22:49:32 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-05-18 22:49:32 +0000
commitbcd6f360b7cabc895660a5f2cc8fdbee4fbe8d19 (patch)
tree5a27652c46d65d3a15f17fceda6fd5c69a11539d /libgps.c
parentb847a45be5a1cb19e375e7b306a732969a139872 (diff)
downloadgpsd-bcd6f360b7cabc895660a5f2cc8fdbee4fbe8d19.tar.gz
Minor bug fixes.
libgps.c: update satellites-used count from Y message. TODO: update the list slightly. configure.ac: fix bug pointed out by Gary Miller.
Diffstat (limited to 'libgps.c')
-rw-r--r--libgps.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libgps.c b/libgps.c
index ecff063c..9d9fbc95 100644
--- a/libgps.c
+++ b/libgps.c
@@ -437,12 +437,14 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
for (j = 0; j < gpsdata->satellites; j++) {
PRN[j]=elevation[j]=azimuth[j]=ss[j]=used[j]=0;
}
- for (j = 0; j < gpsdata->satellites; j++) {
+ for (j = 0, gpsdata->satellites_used = 0; j < gpsdata->satellites; j++) {
sp = strchr(sp, ':') + 1;
(void)sscanf(sp, "%d %d %d %d %d", &i1, &i2, &i3, &i4, &i5);
PRN[j] = i1;
elevation[j] = i2; azimuth[j] = i3;
ss[j] = i4; used[j] = i5;
+ if (i5 == 1)
+ gpsdata->satellites_used++;
}
/*@ -compdef @*/
memcpy(gpsdata->PRN, PRN, sizeof(PRN));
@@ -459,7 +461,7 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
break;
case '$':
/*@ +matchanyintegral @*/
- (void)sscanf(sp, "$=%s %zd %lf %lf %lf %lf %lf %lf",
+ (void)sscanf(sp, "$=%s %d %lf %lf %lf %lf %lf %lf",
gpsdata->tag,
&gpsdata->sentence_length,
&gpsdata->fix.time,