summaryrefslogtreecommitdiff
path: root/gpsctl.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 /gpsctl.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 'gpsctl.c')
-rw-r--r--gpsctl.c266
1 files changed, 134 insertions, 132 deletions
diff --git a/gpsctl.c b/gpsctl.c
index 7f655959..4e6c241b 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -88,18 +88,18 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
(void)strlcat(buf, "\n", sizeof(buf));
/*@-usedef@*/
if (write(gpsdata->gps_fd, buf, strlen(buf)) <= 0) {
- gpsd_report(&context.errout, LOG_ERROR, "gps_query(), write failed\n");
+ gpsd_log(&context.errout, LOG_ERROR, "gps_query(), write failed\n");
return false;
}
/*@+usedef@*/
- gpsd_report(&context.errout, LOG_PROG, "gps_query(), wrote, %s\n", buf);
+ gpsd_log(&context.errout, LOG_PROG, "gps_query(), wrote, %s\n", buf);
FD_ZERO(&rfds);
starttime = time(NULL);
for (;;) {
FD_CLR(gpsdata->gps_fd, &rfds);
- gpsd_report(&context.errout, LOG_PROG, "waiting...\n");
+ gpsd_log(&context.errout, LOG_PROG, "waiting...\n");
/*@ -usedef -type -nullpass -compdef @*/
tv.tv_sec = 2;
@@ -107,16 +107,16 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
if (pselect(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv, &oldset) == -1) {
if (errno == EINTR || !FD_ISSET(gpsdata->gps_fd, &rfds))
continue;
- gpsd_report(&context.errout, LOG_ERROR, "select %s\n", strerror(errno));
+ gpsd_log(&context.errout, LOG_ERROR, "select %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
/*@ +usedef +type +nullpass +compdef @*/
- gpsd_report(&context.errout, LOG_PROG, "reading...\n");
+ gpsd_log(&context.errout, LOG_PROG, "reading...\n");
(void)gps_read(gpsdata);
if (ERROR_SET & gpsdata->set) {
- gpsd_report(&context.errout, LOG_ERROR, "error '%s'\n", gpsdata->error);
+ gpsd_log(&context.errout, LOG_ERROR, "error '%s'\n", gpsdata->error);
return false;
}
@@ -124,9 +124,9 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
if ((expect == NON_ERROR) || (expect & gpsdata->set) != 0)
return true;
else if (timeout > 0 && (time(NULL) - starttime > timeout)) {
- gpsd_report(&context.errout, LOG_ERROR,
- "timed out after %d seconds\n",
- timeout);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "timed out after %d seconds\n",
+ timeout);
return false;
}
/*@ -ignorequals @*/
@@ -138,10 +138,10 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata,
static void onsig(int sig)
{
if (sig == SIGALRM) {
- gpsd_report(&context.errout, LOG_ERROR, "packet recognition timed out.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "packet recognition timed out.\n");
exit(EXIT_FAILURE);
} else {
- gpsd_report(&context.errout, LOG_ERROR, "killed by signal %d\n", sig);
+ gpsd_log(&context.errout, LOG_ERROR, "killed by signal %d\n", sig);
exit(EXIT_SUCCESS);
}
}
@@ -206,8 +206,8 @@ int main(int argc, char **argv)
#ifdef RECONFIGURE_ENABLE
rate = optarg;
#else
- gpsd_report(&context.errout, LOG_ERROR,
- "cycle-change capability has been conditioned out.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "cycle-change capability has been conditioned out.\n");
#endif /* RECONFIGURE_ENABLE */
break;
case 'x': /* ship specified control string */
@@ -215,13 +215,13 @@ int main(int argc, char **argv)
control = optarg;
lowlevel = true;
if ((cooklen = hex_escapes(cooked, control)) <= 0) {
- gpsd_report(&context.errout, LOG_ERROR,
- "invalid escape string (error %d)\n", (int)cooklen);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "invalid escape string (error %d)\n", (int)cooklen);
exit(EXIT_FAILURE);
}
#else
- gpsd_report(&context.errout, LOG_ERROR,
- "control_send capability has been conditioned out.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "control_send capability has been conditioned out.\n");
#endif /* CONTROLSEND_ENABLE */
break;
case 'e': /* echo specified control string with wrapper */
@@ -260,8 +260,8 @@ int main(int argc, char **argv)
#ifdef RECONFIGURE_ENABLE
to_nmea = true;
#else
- gpsd_report(&context.errout, LOG_ERROR,
- "speed-change capability has been conditioned out.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "speed-change capability has been conditioned out.\n");
#endif /* RECONFIGURE_ENABLE */
break;
case 'r': /* force-switch to default mode */
@@ -269,16 +269,16 @@ int main(int argc, char **argv)
reset = true;
lowlevel = false; /* so we'll abort if the daemon is running */
#else
- gpsd_report(&context.errout, LOG_ERROR,
- "reset capability has been conditioned out.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "reset capability has been conditioned out.\n");
#endif /* RECONFIGURE_ENABLE */
break;
case 's': /* change output baud rate */
#ifdef RECONFIGURE_ENABLE
speed = optarg;
#else
- gpsd_report(&context.errout, LOG_ERROR,
- "speed-change capability has been conditioned out.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "speed-change capability has been conditioned out.\n");
#endif /* RECONFIGURE_ENABLE */
break;
case 't': /* force the device type */
@@ -289,15 +289,15 @@ int main(int argc, char **argv)
/*@-nullpass@*/
status = shmget(getenv("GPSD_SHM_KEY") ? (key_t)strtol(getenv("GPSD_SHM_KEY"), NULL, 0) : (key_t)GPSD_SHM_KEY, 0, 0);
if (status == -1) {
- gpsd_report(&context.errout, LOG_WARN,
- "GPSD SHM segment does not exist.\n");
+ gpsd_log(&context.errout, LOG_WARN,
+ "GPSD SHM segment does not exist.\n");
exit(1);
} else {
status = shmctl(status, IPC_RMID, NULL);
if (status == -1) {
- gpsd_report(&context.errout, LOG_ERROR,
- "shmctl failed, errno = %d (%s)\n",
- errno, strerror(errno));
+ gpsd_log(&context.errout, LOG_ERROR,
+ "shmctl failed, errno = %d (%s)\n",
+ errno, strerror(errno));
exit(1);
}
}
@@ -337,22 +337,22 @@ int main(int argc, char **argv)
}
}
if (matchcount == 0)
- gpsd_report(&context.errout, LOG_ERROR,
- "no driver type name matches '%s'.\n", devtype);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "no driver type name matches '%s'.\n", devtype);
else if (matchcount == 1) {
assert(forcetype != NULL);
- gpsd_report(&context.errout, LOG_PROG,
- "%s driver selected.\n", forcetype->type_name);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s driver selected.\n", forcetype->type_name);
} else {
forcetype = NULL;
- gpsd_report(&context.errout, LOG_ERROR,
- "%d driver type names match '%s'.\n",
- matchcount, devtype);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%d driver type names match '%s'.\n",
+ matchcount, devtype);
}
}
if (((int)to_nmea + (int)to_binary + (int)reset) > 1) {
- gpsd_report(&context.errout, LOG_ERROR, "make up your mind, would you?\n");
+ gpsd_log(&context.errout, LOG_ERROR, "make up your mind, would you?\n");
exit(EXIT_SUCCESS);
}
@@ -364,9 +364,9 @@ int main(int argc, char **argv)
if (!lowlevel) {
/* Try to open the stream to gpsd. */
if (gps_open(NULL, NULL, &gpsdata) != 0) {
- gpsd_report(&context.errout, LOG_ERROR,
- "no gpsd running or network error: %s.\n",
- gps_errstr(errno));
+ gpsd_log(&context.errout, LOG_ERROR,
+ "no gpsd running or network error: %s.\n",
+ gps_errstr(errno));
lowlevel = true;
}
}
@@ -380,22 +380,22 @@ int main(int argc, char **argv)
/* what devices have we available? */
if (!gps_query(&gpsdata, DEVICELIST_SET, (int)timeout, "?DEVICES;\n")) {
- gpsd_report(&context.errout, LOG_ERROR, "no DEVICES response received.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "no DEVICES response received.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
}
if (gpsdata.devices.ndevices == 0) {
- gpsd_report(&context.errout, LOG_ERROR, "no devices connected.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "no devices connected.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
} else if (gpsdata.devices.ndevices > 1 && device == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "multiple devices and no device specified.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "multiple devices and no device specified.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
}
- gpsd_report(&context.errout, LOG_PROG,
- "%d device(s) found.\n",gpsdata.devices.ndevices);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%d device(s) found.\n",gpsdata.devices.ndevices);
/* try to mine the devicelist return for the data we want */
if (gpsdata.devices.ndevices == 1 && device == NULL) {
@@ -407,8 +407,8 @@ int main(int argc, char **argv)
if (strcmp(device, gpsdata.devices.list[i].path) == 0) {
goto devicelist_entry_matches;
}
- gpsd_report(&context.errout, LOG_ERROR,
- "specified device not found in device list.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "specified device not found in device list.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
devicelist_entry_matches:;
@@ -421,7 +421,7 @@ int main(int argc, char **argv)
/* if the device has not identified, watch it until it does so */
if (gpsdata.dev.driver[0] == '\0') {
if (gps_stream(&gpsdata, WATCH_ENABLE|WATCH_JSON, NULL) == -1) {
- gpsd_report(&context.errout, LOG_ERROR, "stream set failed.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "stream set failed.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
}
@@ -429,7 +429,7 @@ int main(int argc, char **argv)
while (devcount > 0) {
errno = 0;
if (gps_read(&gpsdata) == -1) {
- gpsd_report(&context.errout, LOG_ERROR, "data read failed.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "data read failed.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
}
@@ -442,7 +442,7 @@ int main(int argc, char **argv)
}
}
}
- gpsd_report(&context.errout, LOG_ERROR, "data read failed.\n");
+ gpsd_log(&context.errout, LOG_ERROR, "data read failed.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);
matching_device_seen:;
@@ -450,8 +450,9 @@ int main(int argc, char **argv)
/* sanity check */
if (gpsdata.dev.driver[0] == '\0') {
- gpsd_report(&context.errout, LOG_SHOUT, "%s can't be identified.\n",
- gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_SHOUT,
+ "%s can't be identified.\n",
+ gpsdata.dev.path);
(void)gps_close(&gpsdata);
exit(EXIT_SUCCESS);
}
@@ -474,8 +475,8 @@ int main(int argc, char **argv)
#ifdef RECONFIGURE_ENABLE
if (reset)
{
- gpsd_report(&context.errout, LOG_PROG,
- "cannot reset with gpsd running.\n");
+ gpsd_log(&context.errout, LOG_PROG,
+ "cannot reset with gpsd running.\n");
exit(EXIT_SUCCESS);
}
@@ -492,26 +493,26 @@ int main(int argc, char **argv)
if (!gps_query(&gpsdata, NON_ERROR, (int)timeout,
"?DEVICE={\"path\":\"%s\",\"native\":0}\r\n",
device)) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s mode change to NMEA failed\n",
- gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s mode change to NMEA failed\n",
+ gpsdata.dev.path);
status = 1;
} else
- gpsd_report(&context.errout, LOG_PROG,
- "%s mode change succeeded\n", gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s mode change succeeded\n", gpsdata.dev.path);
}
else if (to_binary) {
if (!gps_query(&gpsdata, NON_ERROR, (int)timeout,
"?DEVICE={\"path\":\"%s\",\"native\":1}\r\n",
device)) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s mode change to native mode failed\n",
- gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s mode change to native mode failed\n",
+ gpsdata.dev.path);
status = 1;
} else
- gpsd_report(&context.errout, LOG_PROG,
- "%s mode change succeeded\n",
- gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s mode change succeeded\n",
+ gpsdata.dev.path);
}
/*@+boolops@*/
if (speed != NULL) {
@@ -529,20 +530,20 @@ int main(int argc, char **argv)
if (modespec!=NULL) {
*modespec = '\0';
if (strchr("78", *++modespec) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "No support for that word length.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "No support for that word length.\n");
status = 1;
}
parity = *++modespec;
if (strchr("NOE", parity) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "What parity is '%c'?\n", parity);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "What parity is '%c'?\n", parity);
status = 1;
}
stopbits = *++modespec;
if (strchr("12", stopbits) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "Stop bits must be 1 or 2.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "Stop bits must be 1 or 2.\n");
status = 1;
}
}
@@ -553,16 +554,16 @@ int main(int argc, char **argv)
device, speed, parity, stopbits);
}
if (atoi(speed) != (int)gpsdata.dev.baudrate) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s driver won't support %s%c%c\n",
- gpsdata.dev.path,
- speed, parity, stopbits);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s driver won't support %s%c%c\n",
+ gpsdata.dev.path,
+ speed, parity, stopbits);
status = 1;
} else
- gpsd_report(&context.errout, LOG_PROG,
- "%s change to %s%c%c succeeded\n",
- gpsdata.dev.path,
- speed, parity, stopbits);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s change to %s%c%c succeeded\n",
+ gpsdata.dev.path,
+ speed, parity, stopbits);
}
if (rate != NULL) {
(void)gps_query(&gpsdata,
@@ -581,8 +582,8 @@ int main(int argc, char **argv)
int i;
if (device == NULL || forcetype == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "device and type must be specified for the reset operation.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "device and type must be specified for the reset operation.\n");
exit(EXIT_FAILURE);
}
@@ -642,20 +643,20 @@ int main(int argc, char **argv)
if (!(forcetype != NULL && echo)) {
int maxfd = 0;
if (device == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "device must be specified for low-level access.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "device must be specified for low-level access.\n");
exit(EXIT_FAILURE);
}
gpsd_init(&session, &context, device);
if (gpsd_activate(&session, O_PROBEONLY) < 0) {
- gpsd_report(&context.errout, LOG_ERROR,
- "initial GPS device %s open failed\n",
- device);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "initial GPS device %s open failed\n",
+ device);
exit(EXIT_FAILURE);
}
- gpsd_report(&context.errout, LOG_INF,
- "device %s activated\n", session.gpsdata.dev.path);
+ gpsd_log(&context.errout, LOG_INF,
+ "device %s activated\n", session.gpsdata.dev.path);
/*@i1@*/FD_SET(session.gpsdata.gps_fd, &all_fds);
if (session.gpsdata.gps_fd > maxfd)
maxfd = session.gpsdata.gps_fd;
@@ -692,12 +693,12 @@ int main(int argc, char **argv)
break;
case DEVICE_ERROR:
/* this is where a failure to sync lands */
- gpsd_report(&context.errout, LOG_WARN,
- "device error, bailing out.\n");
+ gpsd_log(&context.errout, LOG_WARN,
+ "device error, bailing out.\n");
exit(EXIT_FAILURE);
case DEVICE_EOF:
- gpsd_report(&context.errout, LOG_WARN,
- "device signed off, bailing out.\n");
+ gpsd_log(&context.errout, LOG_WARN,
+ "device signed off, bailing out.\n");
exit(EXIT_SUCCESS);
default:
break;
@@ -705,16 +706,16 @@ int main(int argc, char **argv)
}
/*@+compdef@*/
- gpsd_report(&context.errout, LOG_PROG,
- "%s looks like a %s at %d.\n",
- device, gpsd_id(&session),
- session.gpsdata.dev.baudrate);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s looks like a %s at %d.\n",
+ device, gpsd_id(&session),
+ session.gpsdata.dev.baudrate);
if (forcetype!=NULL && strcmp("NMEA0183", session.device_type->type_name) !=0 && strcmp(forcetype->type_name, session.device_type->type_name)!=0) {
- gpsd_report(&context.errout, LOG_ERROR,
- "'%s' doesn't match non-generic type '%s' of selected device.\n",
- forcetype->type_name,
- session.device_type->type_name);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "'%s' doesn't match non-generic type '%s' of selected device.\n",
+ forcetype->type_name,
+ session.device_type->type_name);
}
}
@@ -742,16 +743,16 @@ int main(int argc, char **argv)
bool write_enable = context.readonly;
context.readonly = false;
if (session.device_type->mode_switcher == NULL) {
- gpsd_report(&context.errout, LOG_SHOUT,
- "%s devices have no mode switch.\n",
- session.device_type->type_name);
+ gpsd_log(&context.errout, LOG_SHOUT,
+ "%s devices have no mode switch.\n",
+ session.device_type->type_name);
status = 1;
} else {
int target_mode = to_nmea ? MODE_NMEA : MODE_BINARY;
- gpsd_report(&context.errout, LOG_SHOUT,
- "switching to mode %s.\n",
- to_nmea ? "NMEA" : "BINARY");
+ gpsd_log(&context.errout, LOG_SHOUT,
+ "switching to mode %s.\n",
+ to_nmea ? "NMEA" : "BINARY");
session.device_type->mode_switcher(&session, target_mode);
settle(&session);
}
@@ -768,29 +769,29 @@ int main(int argc, char **argv)
if (modespec!=NULL) {
*modespec = '\0';
if (strchr("78", *++modespec) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "No support for that word lengths.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "No support for that word lengths.\n");
status = 1;
}
parity = *++modespec;
if (strchr("NOE", parity) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "What parity is '%c'?\n", parity);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "What parity is '%c'?\n", parity);
status = 1;
}
stopbits = *++modespec;
if (strchr("12", parity) == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "Stop bits must be 1 or 2.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "Stop bits must be 1 or 2.\n");
status = 1;
}
stopbits = (int)(stopbits-'0');
}
if (status == 0) {
if (session.device_type->speed_switcher == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s devices have no speed switch.\n",
- session.device_type->type_name);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s devices have no speed switch.\n",
+ session.device_type->type_name);
status = 1;
}
else if (session.device_type->speed_switcher(&session,
@@ -798,15 +799,15 @@ int main(int argc, char **argv)
parity,
stopbits)) {
settle(&session);
- gpsd_report(&context.errout, LOG_PROG,
- "%s change to %s%c%d succeeded\n",
- session.gpsdata.dev.path,
- speed, parity, stopbits);
+ gpsd_log(&context.errout, LOG_PROG,
+ "%s change to %s%c%d succeeded\n",
+ session.gpsdata.dev.path,
+ speed, parity, stopbits);
} else {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s driver won't support %s%c%d.\n",
- session.gpsdata.dev.path,
- speed, parity, stopbits);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s driver won't support %s%c%d.\n",
+ session.gpsdata.dev.path,
+ speed, parity, stopbits);
status = 1;
}
}
@@ -815,15 +816,16 @@ int main(int argc, char **argv)
bool write_enable = context.readonly;
context.readonly = false;
if (session.device_type->rate_switcher == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s devices have no rate switcher.\n",
- session.device_type->type_name);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s devices have no rate switcher.\n",
+ session.device_type->type_name);
status = 1;
} else {
double rate_dbl = strtod(rate, NULL);
if (!session.device_type->rate_switcher(&session, rate_dbl)) {
- gpsd_report(&context.errout, LOG_ERROR, "rate switch failed.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "rate switch failed.\n");
status = 1;
}
settle(&session);
@@ -837,16 +839,16 @@ int main(int argc, char **argv)
bool write_enable = context.readonly;
context.readonly = false;
if (session.device_type->control_send == NULL) {
- gpsd_report(&context.errout, LOG_ERROR,
- "%s devices have no control sender.\n",
- session.device_type->type_name);
+ gpsd_log(&context.errout, LOG_ERROR,
+ "%s devices have no control sender.\n",
+ session.device_type->type_name);
status = 1;
} else {
if (session.device_type->control_send(&session,
cooked,
(size_t)cooklen) == -1) {
- gpsd_report(&context.errout, LOG_ERROR,
- "control transmission failed.\n");
+ gpsd_log(&context.errout, LOG_ERROR,
+ "control transmission failed.\n");
status = 1;
}
settle(&session);