diff options
-rw-r--r-- | gpsd.c | 4 | ||||
-rw-r--r-- | libgpsd_core.c | 10 |
2 files changed, 10 insertions, 4 deletions
@@ -1351,7 +1351,7 @@ static void consume_packets(struct gps_device_t *device) if (changed == ERROR_IS) { gpsd_report(LOG_WARN, - "packet sniffer failed sync with %s (flags %s)\n", + "device read of %s returned error or packet sniffer failed sync (flags %s)\n", device->gpsdata.dev.path, gpsd_maskdump(changed)); deactivate_device(device); @@ -1363,7 +1363,7 @@ static void consume_packets(struct gps_device_t *device) */ if (fragments == 0) { gpsd_report(LOG_WARN, - "%s returned error or went offline\n", + "%s returned zero bytes\n", device->gpsdata.dev.path); deactivate_device(device); } diff --git a/libgpsd_core.c b/libgpsd_core.c index d5301d76..0ef5cac7 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -672,11 +672,17 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) /* update the scoreboard structure from the GPS */ gpsd_report(LOG_RAW + 2, "%s sent %zd new characters\n", session->gpsdata.dev.path, newlen); - if (newlen <= 0) { /* read error or EOF */ - gpsd_report(LOG_INF, "GPS on %s is offline (status %zd, %lf sec since data)\n", + if (newlen < 0) { /* read error */ + gpsd_report(LOG_INF, "GPS on %s returned error %zd (%lf sec since data)\n", session->gpsdata.dev.path, newlen, timestamp() - session->gpsdata.online); session->gpsdata.online = 0; + return ERROR_IS; + } else if (newlen == 0) { /* zero length read, possible EOF */ + gpsd_report(LOG_INF, "GPS on %s is offline (%lf sec since data)\n", + session->gpsdata.dev.path, + timestamp() - session->gpsdata.online); + session->gpsdata.online = 0; return NODATA_IS; } else if (session->packet.outbuflen == 0) { /* got new data, but no packet */ gpsd_report(LOG_RAW + 3, "New data on %s, not yet a packet\n", |