summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-27 20:26:01 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-27 20:26:56 -0400
commit068a90a92337d8476a69ed0048723e7587f6209f (patch)
treefdf92a4fad19701d7469d827feeb4ae5b51c4fb2 /packet.c
parent7b0feb181260ff4e005547a3ae870ebc545b1e85 (diff)
downloadgpsd-068a90a92337d8476a69ed0048723e7587f6209f.tar.gz
Now that the transition is done we can restore the gpsd_report name.
All regression tests pass.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/packet.c b/packet.c
index e8a7f2ab..64835e6b 100644
--- a/packet.c
+++ b/packet.c
@@ -189,7 +189,7 @@ static void character_pushback(struct gps_lexer_t *lexer)
--lexer->inbufptr;
/*@+modobserver@*/
--lexer->char_counter;
- gpsd_notify(&lexer->errout, LOG_RAW + 2,
+ gpsd_report(&lexer->errout, LOG_RAW + 2,
"%08ld: character pushed back\n",
lexer->char_counter);
}
@@ -926,7 +926,7 @@ static void nextstate(struct gps_lexer_t *lexer, unsigned char c)
n++)
csum ^= lexer->inbuffer[n];
if (csum != c) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Navcom packet type 0x%hhx bad checksum 0x%hhx, expecting 0x%x\n",
lexer->inbuffer[3], csum, c);
lexer->state = GROUND_STATE;
@@ -1013,14 +1013,14 @@ static void nextstate(struct gps_lexer_t *lexer, unsigned char c)
short sum = getword(0) + getword(1) + getword(2) + getword(3);
sum *= -1;
if (sum != getword(4)) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Zodiac Header checksum 0x%hx expecting 0x%hx\n",
sum, getword(4));
lexer->state = GROUND_STATE;
break;
}
}
- gpsd_notify(&lexer->errout, LOG_RAW + 1,
+ gpsd_report(&lexer->errout, LOG_RAW + 1,
"Zodiac header id=%hd len=%hd flags=%hx\n",
getword(1), getword(2), getword(3));
#undef getword
@@ -1151,7 +1151,7 @@ static void nextstate(struct gps_lexer_t *lexer, unsigned char c)
if ((c == '>') && (lexer->inbufptr[0] == '<') &&
(lexer->inbufptr[1] == '!')) {
lexer->state = ITALK_RECOGNIZED;
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"ITALK: trying to process runt packet\n");
break;
} else if (--lexer->length == 0)
@@ -1299,7 +1299,7 @@ static void nextstate(struct gps_lexer_t *lexer, unsigned char c)
lexer->state = JSON_STRINGLITERAL;
lexer->json_after = JSON_END_ATTRIBUTE;
} else {
- gpsd_notify(&lexer->errout, LOG_RAW + 2,
+ gpsd_report(&lexer->errout, LOG_RAW + 2,
"%08ld: missing attribute start after header\n",
lexer->char_counter);
lexer->state = GROUND_STATE;
@@ -1394,7 +1394,7 @@ static void packet_accept(struct gps_lexer_t *lexer, int packet_type)
lexer->type = packet_type;
if (lexer->errout.debug >= LOG_RAW+1) {
char scratchbuf[MAX_PACKET_LENGTH*2+1];
- gpsd_notify(&lexer->errout, LOG_RAW+1,
+ gpsd_report(&lexer->errout, LOG_RAW+1,
"Packet type %d accepted %zu = %s\n",
packet_type, packetlen,
gpsd_packetdump(scratchbuf, sizeof(scratchbuf),
@@ -1402,7 +1402,7 @@ static void packet_accept(struct gps_lexer_t *lexer, int packet_type)
lexer->outbuflen));
}
} else {
- gpsd_notify(&lexer->errout, LOG_ERROR,
+ gpsd_report(&lexer->errout, LOG_ERROR,
"Rejected too long packet type %d len %zu\n",
packet_type, packetlen);
}
@@ -1417,7 +1417,7 @@ static void packet_discard(struct gps_lexer_t *lexer)
lexer->inbuflen = remaining;
if (lexer->errout.debug >= LOG_RAW+1) {
char scratchbuf[MAX_PACKET_LENGTH*2+1];
- gpsd_notify(&lexer->errout, LOG_RAW + 1,
+ gpsd_report(&lexer->errout, LOG_RAW + 1,
"Packet discard of %zu, chars remaining is %zu = %s\n",
discard, remaining,
gpsd_packetdump(scratchbuf, sizeof(scratchbuf),
@@ -1432,7 +1432,7 @@ static void character_discard(struct gps_lexer_t *lexer)
lexer->inbufptr = lexer->inbuffer;
if (lexer->errout.debug >= LOG_RAW+1) {
char scratchbuf[MAX_PACKET_LENGTH*2+1];
- gpsd_notify(&lexer->errout, LOG_RAW + 1,
+ gpsd_report(&lexer->errout, LOG_RAW + 1,
"Character discarded, buffer %zu chars = %s\n",
lexer->inbuflen,
gpsd_packetdump(scratchbuf, sizeof(scratchbuf),
@@ -1471,7 +1471,7 @@ void packet_parse(struct gps_lexer_t *lexer)
#include "packet_names.h"
};
nextstate(lexer, c);
- gpsd_notify(&lexer->errout, LOG_RAW + 2,
+ gpsd_report(&lexer->errout, LOG_RAW + 2,
"%08ld: character '%c' [%02x], new state: %s\n",
lexer->char_counter, (isprint(c) ? c : '.'), c,
state_table[lexer->state]);
@@ -1513,7 +1513,7 @@ void packet_parse(struct gps_lexer_t *lexer)
&& csum[1] == toupper(end[2]));
}
if (!checksum_ok) {
- gpsd_notify(&lexer->errout, LOG_WARN,
+ gpsd_report(&lexer->errout, LOG_WARN,
"bad checksum in NMEA packet; expected %s.\n",
csum);
packet_accept(lexer, BAD_PACKET);
@@ -1566,11 +1566,11 @@ void packet_parse(struct gps_lexer_t *lexer)
for (n = 0; n < lexer->length - 2; n++)
a += (unsigned)lexer->inbuffer[n];
b = (unsigned)getleu16(lexer->inbuffer, lexer->length - 2);
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"SuperStarII pkt dump: type %u len %u\n",
lexer->inbuffer[1], (unsigned int)lexer->length);
if (a != b) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"REJECT SuperStarII packet type 0x%02x"
"%zd bad checksum 0x%04x, expecting 0x%04x\n",
lexer->inbuffer[1], lexer->length, a, b);
@@ -1594,12 +1594,12 @@ void packet_parse(struct gps_lexer_t *lexer)
for (i = 2; i < len - 3; i++)
b ^= lexer->inbuffer[i];
if (a == b) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Accept OnCore packet @@%c%c len %d\n",
lexer->inbuffer[2], lexer->inbuffer[3], len);
packet_accept(lexer, ONCORE_PACKET);
} else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"REJECT OnCore packet @@%c%c len %d\n",
lexer->inbuffer[2], lexer->inbuffer[3], len);
packet_accept(lexer, BAD_PACKET);
@@ -1622,7 +1622,7 @@ void packet_parse(struct gps_lexer_t *lexer)
if (dlecnt > 2) {
dlecnt -= 2;
dlecnt /= 2;
- gpsd_notify(&lexer->errout, LOG_RAW,
+ gpsd_report(&lexer->errout, LOG_RAW,
"Unstuffed %d DLEs\n", dlecnt);
packetlen -= dlecnt;
}
@@ -1673,7 +1673,7 @@ void packet_parse(struct gps_lexer_t *lexer)
/*@ +charint */
chksum &= 0xff;
if (chksum) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Garmin checksum failed: %02x!=0\n", chksum);
goto not_garmin;
}
@@ -1681,7 +1681,7 @@ void packet_parse(struct gps_lexer_t *lexer)
packet_discard(lexer);
break;
not_garmin:;
- gpsd_notify(&lexer->errout, LOG_RAW + 1,
+ gpsd_report(&lexer->errout, LOG_RAW + 1,
"Not a Garmin packet\n");
#endif /* GARMIN_ENABLE */
#ifdef TSIP_ENABLE
@@ -1732,7 +1732,7 @@ void packet_parse(struct gps_lexer_t *lexer)
(0xbc == pkt_id) ||
(0x38 == pkt_id))
&& ((0x41 > pkt_id) || (0x8f < pkt_id))) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Packet ID 0x%02x out of range for TSIP\n",
pkt_id);
goto not_tsip;
@@ -1816,14 +1816,14 @@ void packet_parse(struct gps_lexer_t *lexer)
/* pass */ ;
else {
/* pass */ ;
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"TSIP REJECT pkt_id = %#02x, packetlen= %zu\n",
pkt_id, packetlen);
goto not_tsip;
}
#undef TSIP_ID_AND_LENGTH
/* Debug */
- gpsd_notify(&lexer->errout, LOG_RAW,
+ gpsd_report(&lexer->errout, LOG_RAW,
"TSIP pkt_id = %#02x, packetlen= %zu\n",
pkt_id, packetlen);
/*@ -charint +ifempty @*/
@@ -1831,7 +1831,7 @@ void packet_parse(struct gps_lexer_t *lexer)
packet_discard(lexer);
break;
not_tsip:
- gpsd_notify(&lexer->errout, LOG_RAW + 1, "Not a TSIP packet\n");
+ gpsd_report(&lexer->errout, LOG_RAW + 1, "Not a TSIP packet\n");
/*
* More attempts to recognize ambiguous TSIP-like
* packet types could go here.
@@ -1850,7 +1850,7 @@ void packet_parse(struct gps_lexer_t *lexer)
lexer->inbufptr - lexer->inbuffer)) {
packet_accept(lexer, RTCM3_PACKET);
} else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"RTCM3 data checksum failure, "
"%0x against %02x %02x %02x\n",
crc24q_hash(lexer->inbuffer,
@@ -1874,7 +1874,7 @@ void packet_parse(struct gps_lexer_t *lexer)
if (len == 0 || sum == getword(5 + len)) {
packet_accept(lexer, ZODIAC_PACKET);
} else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"Zodiac data checksum 0x%hx over length %hd, expecting 0x%hx\n",
sum, len, getword(5 + len));
packet_accept(lexer, BAD_PACKET);
@@ -1891,7 +1891,7 @@ void packet_parse(struct gps_lexer_t *lexer)
unsigned char ck_a = (unsigned char)0;
unsigned char ck_b = (unsigned char)0;
len = lexer->inbufptr - lexer->inbuffer;
- gpsd_notify(&lexer->errout, LOG_IO, "UBX: len %d\n", len);
+ gpsd_report(&lexer->errout, LOG_IO, "UBX: len %d\n", len);
for (n = 2; n < (len - 2); n++) {
ck_a += lexer->inbuffer[n];
ck_b += ck_a;
@@ -1900,7 +1900,7 @@ void packet_parse(struct gps_lexer_t *lexer)
ck_b == lexer->inbuffer[len - 1])
packet_accept(lexer, UBX_PACKET);
else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"UBX checksum 0x%02hhx%02hhx over length %d,"
" expecting 0x%02hhx%02hhx (type 0x%02hhx%02hhx)\n",
ck_a,
@@ -1951,7 +1951,7 @@ void packet_parse(struct gps_lexer_t *lexer)
goto not_evermore;
crc &= 0xff;
if (crc != checksum) {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"EverMore checksum failed: %02x != %02x\n",
crc, checksum);
goto not_evermore;
@@ -1993,7 +1993,7 @@ void packet_parse(struct gps_lexer_t *lexer)
if (len == 0 || csum == xsum)
packet_accept(lexer, ITALK_PACKET);
else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"ITALK: checksum failed - "
"type 0x%02x expected 0x%04x got 0x%04x\n",
lexer->inbuffer[4], xsum, csum);
@@ -2029,7 +2029,7 @@ void packet_parse(struct gps_lexer_t *lexer)
if (cs == 0)
packet_accept(lexer, GEOSTAR_PACKET);
else {
- gpsd_notify(&lexer->errout, LOG_IO,
+ gpsd_report(&lexer->errout, LOG_IO,
"GeoStar checksum failed 0x%x over length %d\n",
cs, len);
packet_accept(lexer, BAD_PACKET);
@@ -2095,18 +2095,18 @@ ssize_t packet_get(int fd, struct gps_lexer_t *lexer)
/*@ +modobserver @*/
if (recvd == -1) {
if ((errno == EAGAIN) || (errno == EINTR)) {
- gpsd_notify(&lexer->errout, LOG_RAW + 2, "no bytes ready\n");
+ gpsd_report(&lexer->errout, LOG_RAW + 2, "no bytes ready\n");
recvd = 0;
/* fall through, input buffer may be nonempty */
} else {
- gpsd_notify(&lexer->errout, LOG_RAW + 2,
+ gpsd_report(&lexer->errout, LOG_RAW + 2,
"errno: %s\n", strerror(errno));
return -1;
}
} else {
if (lexer->errout.debug >= LOG_RAW+1) {
char scratchbuf[MAX_PACKET_LENGTH*2+1];
- gpsd_notify(&lexer->errout, LOG_RAW + 1,
+ gpsd_report(&lexer->errout, LOG_RAW + 1,
"Read %zd chars to buffer offset %zd (total %zd): %s\n",
recvd, lexer->inbuflen, lexer->inbuflen + recvd,
gpsd_packetdump(scratchbuf, sizeof(scratchbuf),
@@ -2114,7 +2114,7 @@ ssize_t packet_get(int fd, struct gps_lexer_t *lexer)
}
lexer->inbuflen += recvd;
}
- gpsd_notify(&lexer->errout, LOG_SPIN,
+ gpsd_report(&lexer->errout, LOG_SPIN,
"packet_get() fd %d -> %zd (%d)\n",
fd, recvd, errno);