diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-27 16:42:04 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-27 16:42:04 -0400 |
commit | 995976ab06a8f688343b8fec87e1305e2d5ee80e (patch) | |
tree | 104bf6b57b68676529409f4374cc5881b07b1e7b /driver_sirf.c | |
parent | 6203e5b8fcac9d78ea54b7b3c53cb8d084e8a219 (diff) | |
download | gpsd-995976ab06a8f688343b8fec87e1305e2d5ee80e.tar.gz |
The big leap. Most instances of gpsd_report are replaced...
...with calls to gps_notify(), which indirects to its output method
through a slot in an errout structure. Usually the errout structure
lives inside the session context, but because struct errout_t is its
own thing this does not have to be the case. One large clique of
gpsd_notify() calls, in packet.c and isgps.c, looks at a struct
errout_t copy in a lexer control block
This change is not complete. Remnant gpsd_report calls need to be changed,
and gpsmon needs to be tweaked so that the struct_error_t in its context
is a non-defaukt hook updating the cuses display rather than simply
dumping to stderr. Also the report label functionality needs to be added.
All regression tests pass.
Diffstat (limited to 'driver_sirf.c')
-rw-r--r-- | driver_sirf.c | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/driver_sirf.c b/driver_sirf.c index a81295dd..180e0dc1 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -248,7 +248,7 @@ static bool sirf_write(struct gps_device_t *session, unsigned char *msg) */ /* can also be false because ACK was received after last send */ if (session->driver.sirf.need_ack > 0) { - gpsd_report(session->context->errout.debug, LOG_WARN, + gpsd_notify(&session->context->errout, LOG_WARN, "SiRF: warning, write of control type %02x while awaiting ACK for %02x.\n", type, session->driver.sirf.need_ack); } @@ -265,7 +265,7 @@ static bool sirf_write(struct gps_device_t *session, unsigned char *msg) msg[len + 4] = (unsigned char)((crc & 0xff00) >> 8); msg[len + 5] = (unsigned char)(crc & 0x00ff); - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Writing control type %02x:\n", type); ok = (gpsd_write(session, (const char *)msg, len+8) == (ssize_t) (len+8)); @@ -313,11 +313,11 @@ static bool sirfbin_speed(struct gps_device_t *session, speed_t speed, char pari 0x00, 0x00, 0xb0, 0xb3 }; /*@ -charint @*/ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: sirf_speed(%u,%c,%d)\n", (unsigned int)speed, parity, stopbits); if (9600 >= speed) { - gpsd_report(session->context->errout.debug, LOG_WARN, + gpsd_notify(&session->context->errout, LOG_WARN, "SiRF may lag at 9600bps or less.\n"); } @@ -368,7 +368,7 @@ static bool sirf_to_nmea(struct gps_device_t *session, speed_t speed) /*@ -charint @*/ if (speed >= 0xffff) { - gpsd_report(session->context->errout.debug, LOG_ERROR, + gpsd_notify(&session->context->errout, LOG_ERROR, "SiRF: can't switch from SiRF to NMEA because current speed %u is big.", (unsigned int)speed); return false; @@ -424,7 +424,7 @@ static gps_mask_t sirf_msg_debug(struct gps_device_t *device, (void)snprintf(msgbuf + strlen(msgbuf), sizeof(msgbuf) - strlen(msgbuf), "%c", buf[i] ^ 0xff); - gpsd_report(device->context->errout.debug, LOG_PROG, + gpsd_notify(&device->context->errout, LOG_PROG, "SiRF: DEV 0xe1: %s\n", msgbuf); } else if (0xff == (unsigned char)buf[0]) { /* Debug messages */ for (i = 1; i < (int)len; i++) @@ -435,7 +435,7 @@ static gps_mask_t sirf_msg_debug(struct gps_device_t *device, (void)snprintf(msgbuf + strlen(msgbuf), sizeof(msgbuf) - strlen(msgbuf), "\\x%02x", (unsigned int)buf[i]); - gpsd_report(device->context->errout.debug, LOG_PROG, + gpsd_notify(&device->context->errout, LOG_PROG, "SiRF: DBG 0xff: %s\n", msgbuf); } /*@ -charint @*/ @@ -448,18 +448,18 @@ static gps_mask_t sirf_msg_errors(struct gps_device_t *device, { switch (getbeu16(buf, 1)) { case 2: - gpsd_report(device->context->errout.debug, LOG_PROG, + gpsd_notify(&device->context->errout, LOG_PROG, "SiRF: EID 0x0a type 2: Subframe %u error on PRN %u\n", getbeu32(buf, 9), getbeu32(buf, 5)); break; case 4107: - gpsd_report(device->context->errout.debug, LOG_PROG, + gpsd_notify(&device->context->errout, LOG_PROG, "SiRF: EID 0x0a type 4107: neither KF nor LSQ fix.\n"); break; default: - gpsd_report(device->context->errout.debug, LOG_PROG, + gpsd_notify(&device->context->errout, LOG_PROG, "SiRF: EID 0x0a: Error MID %d\n", getbeu16(buf, 1)); break; @@ -481,7 +481,7 @@ static gps_mask_t sirf_msg_nlmd(struct gps_device_t *session, * different double orders, neither IEEE754 */ /* FIXME - decode the time, since this is the first MID with a * good time stamp this will be good for ntpshm time */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: MID 0x1c, NLMD, gps_tow: %f\n", (double)gps_tow); @@ -514,15 +514,15 @@ static gps_mask_t sirf_msg_swversion(struct gps_device_t *session, session->driver.sirf.driverstate |= SIRF_GE_232; } if (strstr((char *)(buf + 1), "ES")) - gpsd_report(session->context->errout.debug, LOG_INF, + gpsd_notify(&session->context->errout, LOG_INF, "SiRF: Firmware has XTrac capability\n"); - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: fv: %0.2f, Driver state flags are: %0x\n", fv, session->driver.sirf.driverstate); #ifdef TIMEHINT_ENABLE session->driver.sirf.time_seen = 0; #endif /* TIMEHINT_ENABLE */ - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: FV MID 0x06: subtype='%s' mask={DEVICEID}\n", session->subtype); return DEVICEID_SET; @@ -544,14 +544,14 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session, words[i] = (uint32_t)getbeu32(buf, 4 * i + 3); } - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: NavData chan %u svid %u\n",chan,svid); #ifdef RECONFIGURE_ENABLE /* SiRF recommends at least 57600 for SiRF IV nav data */ if (!session->context->readonly && session->gpsdata.dev.baudrate < 57600) { /* some USB are also too slow, no way to tell which ones */ - gpsd_report(session->context->errout.debug, LOG_WARN, + gpsd_notify(&session->context->errout, LOG_WARN, "WARNING: SiRF: link too slow, disabling subframes.\n"); (void)sirf_write(session, disablesubframe); } @@ -593,7 +593,7 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, session->gpsdata.azimuth[st] != 0 && session->gpsdata.elevation[st] != 0; #ifdef __UNUSED__ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: PRN=%2d El=%3.2f Az=%3.2f ss=%3d stat=%04x %c\n", getub(buf, off), getub(buf, off + 2) / 2.0, @@ -614,18 +614,18 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, } #ifdef TIMEHINT_ENABLE if (st < 3) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD not enough satellites seen: %d\n", st); } else { /* SiRF says if 3 sats in view the time is good */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD valid time MID 0x04, seen=0x%02x, time:%.2lf, leap:%d\n", session->driver.sirf.time_seen, session->gpsdata.skyview_time, session->context->leap_seconds); } #endif /* TIMEHINT_ENABLE */ - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: MTD 0x04: visible=%d mask={SATELLITE}\n", session->gpsdata.satellites_visible); return SATELLITE_SET; @@ -723,7 +723,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, session->newdata.mode = MODE_2D; if (session->newdata.mode == MODE_3D) mask |= ALTITUDE_SET | CLIMB_SET; - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: MND 0x02: Navtype = 0x%0x, Status = %d, mode = %d\n", navtype, session->gpsdata.status, session->newdata.mode); /* byte 20 is HDOP, see below */ @@ -732,11 +732,11 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, (unsigned short)getbes16(buf, 22), (double)getbeu32(buf, 24) * 1e-2); #ifdef TIMEHINT_ENABLE if (session->newdata.mode <= MODE_NO_FIX) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD no fix, mode: %d\n", session->newdata.mode); } else { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD valid time MID 0x02, seen=0x%02x, time;%.2lf, leap:%d\n", session->driver.sirf.time_seen, session->newdata.time, session->context->leap_seconds); @@ -750,7 +750,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, if ( 3 <= session->gpsdata.satellites_visible ) { mask |= PPSTIME_IS; } - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: MND 0x02: time=%.2f lat=%.2f lon=%.2f alt=%.2f track=%.2f speed=%.2f mode=%d status=%d hdop=%.2f used=%d\n", session->newdata.time, session->newdata.latitude, session->newdata.longitude, session->newdata.altitude, @@ -809,7 +809,7 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, session->newdata.mode = MODE_3D; else if (session->gpsdata.status) session->newdata.mode = MODE_2D; - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: GND 0x29: Navtype = 0x%0x, Status = %d, mode = %d\n", navtype, session->gpsdata.status, session->newdata.mode); mask |= STATUS_SET | MODE_SET; @@ -877,20 +877,20 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, /*@ -compdef -unrecog */ session->newdata.time = (timestamp_t)timegm(&unpacked_date) + subseconds; /*@ +compdef +unrecog */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: GND 0x29 UTC: %lf\n", session->newdata.time); #ifdef TIMEHINT_ENABLE if (session->newdata.mode <= MODE_NO_FIX) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD no fix, mode: $d\n", session->newdata.mode); } else if (0 == unpacked_date.tm_year) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD no year\n", session->newdata.mode); } else { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD valid time MID 0x29, seen=0x%02x\n", session->driver.sirf.time_seen); } @@ -910,7 +910,7 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, if (session->newdata.mode == MODE_3D) mask |= ALTITUDE_SET | CLIMB_SET; } - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: GND 0x29: time=%.2f lat=%.2f lon=%.2f alt=%.2f track=%.2f speed=%.2f mode=%d status=%d\n", session->newdata.time, session->newdata.latitude, @@ -985,7 +985,7 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, session->newdata.mode = MODE_3D; else if (session->gpsdata.status) session->newdata.mode = MODE_2D; - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: EMND 0x62: Navtype = 0x%0x, Status = %d, mode = %d\n", navtype, session->gpsdata.status, session->newdata.mode); @@ -1008,10 +1008,10 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, /*@ +compdef */ #ifdef TIMEHINT_ENABLE if (0 == (session->driver.sirf.time_seen & TIME_SEEN_UTC_2)) { - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "SiRF: NTPD just SEEN_UTC_2\n"); } - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD valid time MID 0x62, seen=0x%02x\n", session->driver.sirf.time_seen); session->driver.sirf.time_seen |= TIME_SEEN_UTC_2; @@ -1025,7 +1025,7 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, session->gpsdata.dop.vdop = (int)getub(buf, 37) / 5.0; session->gpsdata.dop.tdop = (int)getub(buf, 38) / 5.0; session->driver.sirf.driverstate |= UBLOX; - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "SiRF: EMD 0x62: time=%.2f lat=%.2f lon=%.2f alt=%.f speed=%.2f track=%.2f climb=%.2f mode=%d status=%d gdop=%.2f pdop=%.2f hdop=%.2f vdop=%.2f tdop=%.2f\n", session->newdata.time, session->newdata.latitude, session->newdata.longitude, session->newdata.altitude, @@ -1045,7 +1045,7 @@ static gps_mask_t sirf_msg_ppstime(struct gps_device_t *session, if (len != 19) return 0; - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: PPS 0x34: Status = 0x%02x\n", getub(buf, 14)); if (((int)getub(buf, 14) & 0x07) == 0x07) { /* valid UTC time? */ @@ -1063,10 +1063,10 @@ static gps_mask_t sirf_msg_ppstime(struct gps_device_t *session, session->context->valid |= LEAP_SECOND_VALID; #ifdef TIMEHINT_ENABLE if (0 == (session->driver.sirf.time_seen & TIME_SEEN_UTC_2)) { - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "SiRF: NTPD just SEEN_UTC_2\n"); } - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NTPD valid time MID 0x34, seen=0x%02x, leap=%d\n", session->driver.sirf.time_seen, session->context->leap_seconds); @@ -1089,47 +1089,47 @@ static gps_mask_t sirf_msg_nl(struct gps_device_t *session, switch ( buf[1] ) { case 1: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 1, GPS Data\n"); break; case 2: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 2, EE Integrity\n"); break; case 3: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 3, EE Integrity\n"); break; case 4: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, EE Clock Bias\n"); break; case 5: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, 50bps\n"); break; case 32: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, ECLM ACK/NACK\n"); break; case 33: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, ECLM EE Age\n"); break; case 34: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, ECLM SGEE Age\n"); break; case 35: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, ECLM Download Intiate\n"); break; case 255: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, SubID: 4, EE ACK\n"); break; default: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused EE 0x38, unknown SubID: %d\n", buf[1]); } @@ -1146,16 +1146,16 @@ static gps_mask_t sirf_msg_ee(struct gps_device_t *session, switch ( buf[1] ) { case 1: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused NL 0x40, SubID: 1\n"); break; case 2: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused NL 0x40, SubID: 2, PRN: %d\n", buf[2]); break; default: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused NL 0x40, unknown SubID: %d\n", buf[1]); } @@ -1173,7 +1173,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, buf += 4; len -= 8; - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "SiRF: Raw packet type 0x%02x\n", buf[0]); session->driver.sirf.lastid = buf[0]; @@ -1186,7 +1186,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_navsol(session, buf, len) | (CLEAR_IS | REPORT_IS); else { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: MND 0x02 skipped, u-blox flag is on.\n"); return 0; } @@ -1194,7 +1194,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_svinfo(session, buf, len); case 0x05: /* Raw Tracker Data Out MID 5 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: unused Raw Tracker Data 0x05\n"); return 0; @@ -1202,7 +1202,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_swversion(session, buf, len); case 0x07: /* Clock Status Data MID 7 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused CLK 0x07\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused CLK 0x07\n"); return 0; case 0x08: /* subframe data MID 8 */ @@ -1220,7 +1220,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_navdata(session, buf, len); case 0x09: /* CPU Throughput MID 9 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: THR 0x09: SegStatMax=%.3f, SegStatLat=%3.f, AveTrkTime=%.3f, Last MS=%u\n", (float)getbeu16(buf, 1) / 186, (float)getbeu16(buf, 3) / 186, @@ -1231,36 +1231,36 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_errors(session, buf, len); case 0x0b: /* Command Acknowledgement MID 11 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: ACK 0x0b: %02x\n", getub(buf, 1)); session->driver.sirf.need_ack = 0; return 0; case 0x0c: /* Command NAcknowledgement MID 12 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: NAK 0x0c: %02x\n", getub(buf, 1)); /* ugh -- there's no alternative but silent failure here */ session->driver.sirf.need_ack = 0; return 0; case 0x0d: /* Visible List MID 13 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused VIS 0x0d\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused VIS 0x0d\n"); return 0; case 0x0e: /* Almanac Data MID 14 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused ALM 0x0e\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused ALM 0x0e\n"); return 0; case 0x0f: /* Ephemeris Data MID 15 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused EPH 0x0f\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused EPH 0x0f\n"); return 0; case 0x11: /* Differential Corrections MID 17 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused DIFF 0x11\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused DIFF 0x11\n"); return 0; case 0x12: /* OK To Send MID 18 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: OTS 0x12: send indicator = %d\n", getub(buf, 1)); return 0; @@ -1275,23 +1275,23 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_nlmd(session, buf, len); case 0x1d: /* Navigation Library DGPS Data MID 29 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused NLDG 0x1d\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused NLDG 0x1d\n"); return 0; case 0x1e: /* Navigation Library SV State Data MID 30 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused NLSV 0x1e\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused NLSV 0x1e\n"); return 0; case 0x1f: /* Navigation Library Initialization Data MID 31 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused NLID 0x1f\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused NLID 0x1f\n"); return 0; case 0x29: /* Geodetic Navigation Data MID 41 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused GND 0x29\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused GND 0x29\n"); return 0; case 0x32: /* SBAS corrections MID 50 */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unused SBAS 0x32\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unused SBAS 0x32\n"); return 0; case 0x34: /* PPS Time MID 52 */ @@ -1325,28 +1325,28 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return sirf_msg_nl(session, buf, len); case 0x47: /* Hardware Config MID 71 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused Hardware Config 0x47\n"); return 0; case 0x5c: /* CW Controller Output MID 92 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused CW Controller Output 0x5c\n"); return 0; case 0x5d: /* TCXO Output MID 93 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF IV: unused TCXO Output 0x5d, SubID: %d\n", buf[1]); return 0; case 0x62: /* u-blox Extended Measured Navigation Data MID 98 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: u-blox EMND 0x62\n"); return sirf_msg_ublox(session, buf, len) | (CLEAR_IS | REPORT_IS); case 0x80: /* Initialize Data Source MID 128 */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: unused INIT 0x80\n"); return 0; @@ -1357,7 +1357,7 @@ gps_mask_t sirf_parse(struct gps_device_t * session, unsigned char *buf, return 0; default: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Unknown packet id %d length %zd\n", buf[0], len); return 0; @@ -1379,7 +1379,7 @@ static gps_mask_t sirfbin_parse_input(struct gps_device_t *session) static void sirfbin_init_query(struct gps_device_t *session) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Probing for firmware version.\n"); (void)sirf_write(session, versionprobe); } @@ -1391,7 +1391,7 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) if (event == event_identified || event == event_reactivate) { if (session->lexer.type == NMEA_PACKET) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Switching chip mode to binary.\n"); (void)nmea_send(session, "$PSRF100,0,%d,8,1,0", @@ -1414,7 +1414,7 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) case 1: #ifdef RECONFIGURE_ENABLE /* unset MID 0x40 = 64 first since there is a flood of them */ - gpsd_report(session->context->errout.debug, LOG_PROG,"SiRF: unset MID 64.\n"); + gpsd_notify(&session->context->errout, LOG_PROG,"SiRF: unset MID 64.\n"); putbyte(unsetmidXX, 6, 0x40); (void)sirf_write(session, unsetmidXX); break; @@ -1424,14 +1424,14 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) * The response to this request will save the navigation * parameters so they can be reverted before close. */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Requesting navigation parameters.\n"); (void)sirf_write(session, navparams); break; case 3: /* unset GND (0x29 = 41), it's not reliable on SiRF II */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: unset MID 64.\n"); putbyte(unsetmidXX, 6, 0x29); (void)sirf_write(session, unsetmidXX); @@ -1439,38 +1439,38 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) case 4: if (!session->context->readonly) { - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Setting Navigation Parameters.\n"); (void)sirf_write(session, modecontrol); } break; case 5: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Requesting periodic ecef reports.\n"); (void)sirf_write(session, requestecef); break; case 6: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Requesting periodic tracker reports.\n"); (void)sirf_write(session, requesttracker); break; case 7: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Setting DGPS control to use SBAS.\n"); (void)sirf_write(session, dgpscontrol); break; case 8: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Setting SBAS to auto/integrity mode.\n"); (void)sirf_write(session, sbasparams); break; case 9: - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Enabling PPS message.\n"); (void)sirf_write(session, enablemid52); break; @@ -1479,12 +1479,12 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) /* SiRF recommends at least 57600 for SiRF IV nav data */ if (session->gpsdata.dev.baudrate >= 57600) { /* fast enough, turn on nav data */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Enabling subframe transmission.\n"); (void)sirf_write(session, enablesubframe); } else { /* too slow, turn off nav data */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Disabling subframe transmission.\n"); (void)sirf_write(session, disablesubframe); } @@ -1495,7 +1495,7 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) * Disable navigation debug messages (the value 5 is magic) * must be done *after* subframe enable. */ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: disable MID 7, 28, 29, 30, 31.\n"); putbyte(unsetmidXX, 5, 0x05); (void)sirf_write(session, unsetmidXX); @@ -1534,7 +1534,7 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event) putbyte(moderevert, 16, session->driver.sirf.dr_timeout); putbyte(moderevert, 17, session->driver.sirf.track_smooth_mode); /*@ +shiftimplementation @*/ - gpsd_report(session->context->errout.debug, LOG_PROG, + gpsd_notify(&session->context->errout, LOG_PROG, "SiRF: Reverting navigation parameters...\n"); (void)sirf_write(session, moderevert); } |