summaryrefslogtreecommitdiff
path: root/net_dgpsip.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 /net_dgpsip.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 'net_dgpsip.c')
-rw-r--r--net_dgpsip.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net_dgpsip.c b/net_dgpsip.c
index f7209534..c7d305c5 100644
--- a/net_dgpsip.c
+++ b/net_dgpsip.c
@@ -36,17 +36,19 @@ int dgpsip_open(struct gps_device_t *device, const char *dgpsserver)
netlib_connectsock(AF_UNSPEC, dgpsserver, dgpsport, "tcp");
if (device->gpsdata.gps_fd >= 0) {
char hn[256], buf[BUFSIZ];
- gpsd_report(LOG_PROG, "connection to DGPS server %s established.\n",
+ gpsd_report(device->context->debug, LOG_PROG,
+ "connection to DGPS server %s established.\n",
dgpsserver);
(void)gethostname(hn, sizeof(hn));
/* greeting required by some RTCM104 servers; others will ignore it */
(void)snprintf(buf, sizeof(buf), "HELO %s gpsd %s\r\nR\r\n", hn,
VERSION);
if (write(device->gpsdata.gps_fd, buf, strlen(buf)) != (ssize_t) strlen(buf))
- gpsd_report(LOG_ERROR, "hello to DGPS server %s failed\n",
+ gpsd_report(device->context->debug, LOG_ERROR,
+ "hello to DGPS server %s failed\n",
dgpsserver);
} else
- gpsd_report(LOG_ERROR,
+ gpsd_report(device->context->debug, LOG_ERROR,
"can't connect to DGPS server %s, netlib error %d.\n",
dgpsserver, device->gpsdata.gps_fd);
opts = fcntl(device->gpsdata.gps_fd, F_GETFL);
@@ -78,9 +80,9 @@ void dgpsip_report(struct gps_context_t *context,
gps->gpsdata.fix.altitude);
if (write(dgpsip->gpsdata.gps_fd, buf, strlen(buf)) ==
(ssize_t) strlen(buf))
- gpsd_report(LOG_IO, "=> dgps %s\n", buf);
+ gpsd_report(context->debug, LOG_IO, "=> dgps %s\n", buf);
else
- gpsd_report(LOG_IO, "write to dgps FAILED\n");
+ gpsd_report(context->debug, LOG_IO, "write to dgps FAILED\n");
}
}
}