summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2008-07-13 10:12:17 +0000
committerEric S. Raymond <esr@thyrsus.com>2008-07-13 10:12:17 +0000
commitcebe4d4c695c75d686a387b57e3d19bae5ccafb9 (patch)
tree055790d3e3e59d84d3d8c6ae01f28c82efcf16d5 /packet.c
parentb683a8eb129a1ee677618fe8197d610eec769c64 (diff)
downloadgpsd-cebe4d4c695c75d686a387b57e3d19bae5ccafb9.tar.gz
Improved debugging message.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/packet.c b/packet.c
index 72a09e6a..1a085b1b 100644
--- a/packet.c
+++ b/packet.c
@@ -1264,22 +1264,25 @@ ssize_t packet_get(int fd, struct gps_packet_t *lexer)
/*@ -modobserver @*/
recvd = read(fd, lexer->inbuffer+lexer->inbuflen,
sizeof(lexer->inbuffer)-(lexer->inbuflen));
-#ifdef STATE_DEBUG
- gpsd_report(LOG_RAW+1, "%d raw bytes read from %d: %s\n",
- recvd, fd, gpsd_hexdump(lexer->inbuffer+lexer->inbuflen, recvd));
-#endif /* STATE_DEBUG */
/*@ +modobserver @*/
if (recvd == -1) {
if ((errno == EAGAIN) || (errno == EINTR)) {
+#ifdef STATE_DEBUG
+ gpsd_report(LOG_RAW+2, "no bytes ready\n");
+#endif /* STATE_DEBUG */
return 0;
} else {
#ifdef STATE_DEBUG
- gpsd_report(LOG_RAW+1, "errno: %s\n", strerror(errno));
+ gpsd_report(LOG_RAW+2, "errno: %s\n", strerror(errno));
#endif /* STATE_DEBUG */
return EOF_PACKET;
}
}
+#ifdef STATE_DEBUG
+ gpsd_report(LOG_RAW+2, "%d raw bytes read from %d: %s\n",
+ recvd, fd, gpsd_hexdump(lexer->inbuffer+lexer->inbuflen, (size_t)recvd));
+#endif /* STATE_DEBUG */
if (recvd == 0)
return 0;
return packet_parse(lexer, (size_t)recvd);