summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2009-11-11 07:18:39 +0000
committerGary E. Miller <gem@rellim.com>2009-11-11 07:18:39 +0000
commit6319e80f9e2f7f7ebac8fd153bb9ce48496f4842 (patch)
tree1b2729cbe52e8934c90e8817fbfb4bb9159e1525 /gpsd.c
parent206ea8ecc5c4b4a1425d27ff04d23a1f424d8db1 (diff)
downloadgpsd-6319e80f9e2f7f7ebac8fd153bb9ce48496f4842.tar.gz
Add some gpsd side JSON error reporting.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index 59dbd49a..5a86b844 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1599,6 +1599,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Invalid WATCH: %s\"}\r\n",
json_error_string(status));
+ gpsd_report(LOG_ERROR, reply);
} else if (sub->policy.watcher) {
if (sub->policy.devpath[0] == '\0') {
/* assign all devices */
@@ -1610,10 +1611,12 @@ static void handle_newstyle_request(struct subscriber_t *sub,
if (devp == NULL) {
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Do nuch device as %s\"}\r\n", sub->policy.devpath);
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
} else if (assign_channel(sub, ANY, devp) == NULL)
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Can't assign %s\"}\r\n", sub->policy.devpath);
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
}
}
@@ -1645,6 +1648,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Invalid DEVICE: %s\"}\r\n",
json_error_string(status));
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
} else {
if (devconf.path[0]!='\0') {
@@ -1653,6 +1657,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Can't open %s.\"}\r\n",
devconf.path);
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
}
} else {
@@ -1662,10 +1667,12 @@ static void handle_newstyle_request(struct subscriber_t *sub,
(void)strlcat(reply,
"{\"class\":\"ERROR\",\"message\":\"Can't perform DEVICE configuration, no channels attached.\"}\r\n",
replylen);
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
} else if (chcount > 1) {
(void)snprintf(reply+strlen(reply), replylen-strlen(reply),
"{\"class\":\"ERROR\",\"message\":\"No path specified in DEVICE, but multiple channels are subscribed.\"}\r\n");
+ gpsd_report(LOG_ERROR, reply);
goto bailout;
} else {
/* we should have exactly one device now */
@@ -1739,6 +1746,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Unrecognized request '%.*s'\"}\r\n",
(int)(errend-buf+1), buf);
+ gpsd_report(LOG_ERROR, reply);
buf += strlen(buf);
}
bailout: