summaryrefslogtreecommitdiff
path: root/driver_garmin_txt.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 11:51:15 -0500
commitdf34a3add8df382eb852a67635c6859ee8cc657f (patch)
treec52183ba41403d093ad1ac971fa45c4ba1289f0c /driver_garmin_txt.c
parent9c49083f2afe799343a610912b0ed404b2ffad05 (diff)
downloadgpsd-df34a3add8df382eb852a67635c6859ee8cc657f.tar.gz
gpsd-report() -> gpsd_log()
This change is done so we can add a "log" hook to the pps_thread_t structure (this is not done yet) and harmonize with the name of the outer logging function. If that name had been left as gpsd_report() there would have been scope for bad confusion with the report_hook member. Also, remove two stray duplicative printf calls from the NMEA2000 driver (drivers shouldn't have printfs!) and fix one typo. This is a step towards factoring out ntplib. For that to happen, the PPS thread code needs to be decoupled from the core session structure. No logic changes. Object compatibility preserved. All regression tests pass.
Diffstat (limited to 'driver_garmin_txt.c')
-rw-r--r--driver_garmin_txt.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/driver_garmin_txt.c b/driver_garmin_txt.c
index 5d249909..adeaf361 100644
--- a/driver_garmin_txt.c
+++ b/driver_garmin_txt.c
@@ -153,13 +153,13 @@ static int gar_decode(const struct gps_context_t *context,
/* splint is buggy here, thinks buf can be a null pointer */
/*@ -mustdefine -nullderef -nullpass @*/
if (length >= sizeof(buf)) {
- gpsd_report(&context->errout, LOG_ERROR, "internal buffer too small\n");
+ gpsd_log(&context->errout, LOG_ERROR, "internal buffer too small\n");
return -1;
}
bzero(buf, (int)sizeof(buf));
(void)strlcpy(buf, data, length);
- gpsd_report(&context->errout, LOG_RAW + 2, "Decoded string: %s\n", buf);
+ gpsd_log(&context->errout, LOG_RAW + 2, "Decoded string: %s\n", buf);
if (strchr(buf, '_') != NULL) {
/* value is not valid, ignore it */
@@ -186,14 +186,14 @@ static int gar_decode(const struct gps_context_t *context,
break;
}
}
- gpsd_report(&context->errout, LOG_WARN,
- "Unexpected char \"%c\" in data \"%s\"\n",
- buf[0], buf);
+ gpsd_log(&context->errout, LOG_WARN,
+ "Unexpected char \"%c\" in data \"%s\"\n",
+ buf[0], buf);
return -1;
} while (0);
if (strspn(buf + offset, "0123456789") != length - offset) {
- gpsd_report(&context->errout, LOG_WARN, "Invalid value %s\n", buf);
+ gpsd_log(&context->errout, LOG_WARN, "Invalid value %s\n", buf);
return -1;
}
/*@ +mustdefine +nullderef +nullpass @*/
@@ -223,13 +223,13 @@ static int gar_int_decode(const struct gps_context_t *context,
/*@ -mustdefine @*/
if (length >= sizeof(buf)) {
- gpsd_report(&context->errout, LOG_ERROR, "internal buffer too small\n");
+ gpsd_log(&context->errout, LOG_ERROR, "internal buffer too small\n");
return -1;
}
bzero(buf, (int)sizeof(buf));
(void)strlcpy(buf, data, length);
- gpsd_report(&context->errout, LOG_RAW + 2, "Decoded string: %s\n", buf);
+ gpsd_log(&context->errout, LOG_RAW + 2, "Decoded string: %s\n", buf);
if (strchr(buf, '_') != NULL) {
/* value is not valid, ignore it */
@@ -238,7 +238,7 @@ static int gar_int_decode(const struct gps_context_t *context,
/*@ -nullpass @*//* splint bug */
if (strspn(buf, "0123456789") != length) {
- gpsd_report(&context->errout, LOG_WARN, "Invalid value %s\n", buf);
+ gpsd_log(&context->errout, LOG_WARN, "Invalid value %s\n", buf);
return -1;
}
@@ -247,9 +247,9 @@ static int gar_int_decode(const struct gps_context_t *context,
*result = res;
return 0; /* SUCCESS */
} else {
- gpsd_report(&context->errout, LOG_WARN,
- "Value %u out of range <%u, %u>\n", res, min,
- max);
+ gpsd_log(&context->errout, LOG_WARN,
+ "Value %u out of range <%u, %u>\n", res, min,
+ max);
return -1;
}
/*@ +mustdefine +nullpass @*/
@@ -268,14 +268,14 @@ gps_mask_t garmintxt_parse(struct gps_device_t * session)
gps_mask_t mask = 0;
- gpsd_report(&session->context->errout, LOG_PROG,
- "Garmin Simple Text packet, len %zd: %s\n",
- session->lexer.outbuflen, (char*)session->lexer.outbuffer);
+ gpsd_log(&session->context->errout, LOG_PROG,
+ "Garmin Simple Text packet, len %zd: %s\n",
+ session->lexer.outbuflen, (char*)session->lexer.outbuffer);
if (session->lexer.outbuflen < 54) {
/* trailing CR and LF can be ignored; ('@' + 54x 'DATA' + '\r\n') has length 57 */
- gpsd_report(&session->context->errout, LOG_WARN,
- "Message is too short, rejected.\n");
+ gpsd_log(&session->context->errout, LOG_WARN,
+ "Message is too short, rejected.\n");
return ONLINE_SET;
}
@@ -286,7 +286,7 @@ gps_mask_t garmintxt_parse(struct gps_device_t * session)
do {
unsigned int result;
char *buf = (char *)session->lexer.outbuffer + 1;
- gpsd_report(&session->context->errout, LOG_PROG, "Timestamp: %.12s\n", buf);
+ gpsd_log(&session->context->errout, LOG_PROG, "Timestamp: %.12s\n", buf);
/* year */
if (0 != gar_int_decode(session->context,
@@ -460,14 +460,14 @@ gps_mask_t garmintxt_parse(struct gps_device_t * session)
mask |= CLIMB_SET;
} while (0);
- gpsd_report(&session->context->errout, LOG_DATA,
- "GTXT: time=%.2f, lat=%.2f lon=%.2f alt=%.2f speed=%.2f track=%.2f climb=%.2f exp=%.2f epy=%.2f mode=%d status=%d\n",
- session->newdata.time, session->newdata.latitude,
- session->newdata.longitude, session->newdata.altitude,
- session->newdata.speed, session->newdata.track,
- session->newdata.climb, session->newdata.epx,
- session->newdata.epy, session->newdata.mode,
- session->gpsdata.status);
+ gpsd_log(&session->context->errout, LOG_DATA,
+ "GTXT: time=%.2f, lat=%.2f lon=%.2f alt=%.2f speed=%.2f track=%.2f climb=%.2f exp=%.2f epy=%.2f mode=%d status=%d\n",
+ session->newdata.time, session->newdata.latitude,
+ session->newdata.longitude, session->newdata.altitude,
+ session->newdata.speed, session->newdata.track,
+ session->newdata.climb, session->newdata.epx,
+ session->newdata.epy, session->newdata.mode,
+ session->gpsdata.status);
return mask;
}