summaryrefslogtreecommitdiff
path: root/driver_zodiac.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-09-29 01:42:45 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-09-29 01:46:53 -0400
commit4361ec2d89bdf451602d659ddfd0fb9a79c178a2 (patch)
treeaf067d1d7614a9e67f449eec933ba3347cde10b0 /driver_zodiac.c
parenta77b95b57475c2856707e91b197f8aaa8e5eb407 (diff)
downloadgpsd-4361ec2d89bdf451602d659ddfd0fb9a79c178a2.tar.gz
Change gpsd_report to no longer use a global. All regression tests pass.
This is a large, ugly change. But without it we can't troubleshoot the ICP/IP-source initialization bug properly - colliding definitions of gpsd_report() were interfering with error reporting early in gpsd runs. More cleanup work remains to be done, but at least this is working.
Diffstat (limited to 'driver_zodiac.c')
-rw-r--r--driver_zodiac.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/driver_zodiac.c b/driver_zodiac.c
index 63ee40e8..1af2250d 100644
--- a/driver_zodiac.c
+++ b/driver_zodiac.c
@@ -94,7 +94,8 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type,
if (end_write(session->gpsdata.gps_fd, &h, hlen) != (ssize_t) hlen ||
end_write(session->gpsdata.gps_fd, dat,
datlen) != (ssize_t) datlen) {
- gpsd_report(LOG_RAW, "Reconfigure write failed\n");
+ gpsd_report(session->context->debug, LOG_RAW,
+ "Reconfigure write failed\n");
return -1;
}
}
@@ -106,7 +107,8 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type,
(void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
" %04x", dat[i]);
- gpsd_report(LOG_RAW, "Sent Zodiac packet: %s\n", buf);
+ gpsd_report(session->context->debug, LOG_RAW,
+ "Sent Zodiac packet: %s\n", buf);
return 0;
}
@@ -212,7 +214,7 @@ static gps_mask_t handle1000(struct gps_device_t *session)
mask =
TIME_SET | PPSTIME_IS | LATLON_SET | ALTITUDE_SET | CLIMB_SET | SPEED_SET |
TRACK_SET | STATUS_SET | MODE_SET;
- gpsd_report(LOG_DATA,
+ gpsd_report(session->context->debug, LOG_DATA,
"1000: time=%.2f lat=%.2f lon=%.2f alt=%.2f track=%.2f speed=%.2f climb=%.2f mode=%d status=%d\n",
session->newdata.time, session->newdata.latitude,
session->newdata.longitude, session->newdata.altitude,
@@ -257,7 +259,8 @@ static gps_mask_t handle1002(struct gps_device_t *session)
session->gpsdata.skyview_time = gpsd_gpstime_resolve(session,
(unsigned short)gps_week,
(double)gps_seconds);
- gpsd_report(LOG_DATA, "1002: visible=%d used=%d mask={SATELLITE|USED}\n",
+ gpsd_report(session->context->debug, LOG_DATA,
+ "1002: visible=%d used=%d mask={SATELLITE|USED}\n",
session->gpsdata.satellites_visible,
session->gpsdata.satellites_used);
return SATELLITE_SET | USED_IS;
@@ -302,7 +305,8 @@ static gps_mask_t handle1003(struct gps_device_t *session)
}
}
session->gpsdata.skyview_time = NAN;
- gpsd_report(LOG_DATA, "NAVDOP: visible=%d gdop=%.2f pdop=%.2f "
+ gpsd_report(session->context->debug, LOG_DATA,
+ "NAVDOP: visible=%d gdop=%.2f pdop=%.2f "
"hdop=%.2f vdop=%.2f tdop=%.2f mask={SATELLITE|DOP}\n",
session->gpsdata.satellites_visible,
session->gpsdata.dop.gdop,
@@ -336,7 +340,8 @@ static gps_mask_t handle1011(struct gps_device_t *session)
* The Zodiac is supposed to send one of these messages on startup.
*/
getstringz(session->subtype, session->packet.outbuffer, 19, 28); /* software version field */
- gpsd_report(LOG_DATA, "1011: subtype=%s mask={DEVICEID}\n",
+ gpsd_report(session->context->debug, LOG_DATA,
+ "1011: subtype=%s mask={DEVICEID}\n",
session->subtype);
return DEVICEID_SET;
}
@@ -365,11 +370,13 @@ static gps_mask_t zodiac_analyze(struct gps_device_t *session)
if (session->packet.type != ZODIAC_PACKET) {
const struct gps_type_t **dp;
- gpsd_report(LOG_PROG, "zodiac_analyze packet type %d\n",
+ gpsd_report(session->context->debug, LOG_PROG,
+ "zodiac_analyze packet type %d\n",
session->packet.type);
// Wrong packet type ?
// Maybe find a trigger just in case it's an Earthmate
- gpsd_report(LOG_RAW + 4, "Is this a trigger: %s ?\n",
+ gpsd_report(session->context->debug, LOG_RAW + 4,
+ "Is this a trigger: %s ?\n",
(char *)session->packet.outbuffer);
for (dp = gpsd_drivers; *dp; dp++) {
@@ -379,7 +386,7 @@ static gps_mask_t zodiac_analyze(struct gps_device_t *session)
&& strncmp((char *)session->packet.outbuffer, trigger,
strlen(trigger)) == 0
&& isatty(session->gpsdata.gps_fd) != 0) {
- gpsd_report(LOG_PROG, "found %s.\n", trigger);
+ gpsd_report(session->context->debug, LOG_PROG, "found %s.\n", trigger);
(void)gpsd_switch_driver(session, (*dp)->type_name);
return 0;
@@ -392,7 +399,8 @@ static gps_mask_t zodiac_analyze(struct gps_device_t *session)
for (i = 0; i < (int)session->packet.outbuflen; i++)
(void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
"%02x", (unsigned int)session->packet.outbuffer[i]);
- gpsd_report(LOG_RAW, "Raw Zodiac packet type %d length %zd: %s\n",
+ gpsd_report(session->context->debug, LOG_RAW,
+ "Raw Zodiac packet type %d length %zd: %s\n",
id, session->packet.outbuflen, buf);
if (session->packet.outbuflen < 10)