From 0c5f6290709082d02c5877b9efa316c66fae7849 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 2 Oct 2013 21:47:39 -0400 Subject: Redirect more data to the GPS through gpsd_write(). --- drivers.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'drivers.c') diff --git a/drivers.c b/drivers.c index cd609225..6a9dddb7 100644 --- a/drivers.c +++ b/drivers.c @@ -689,11 +689,13 @@ static const struct gps_type_t earthmate = { * **************************************************************************/ -static void tnt_add_checksum(char *sentence) -/* add NMEA-style CRC checksum to a command */ +static ssize_t tnt_control_send(struct gps_device_t *session, + char *msg, size_t len UNUSED) +/* send a control string in TNT native formal */ { + ssize_t status; unsigned char sum = '\0'; - char c, *p = sentence; + char c, *p = msg; if (*p == '@') { p++; @@ -701,7 +703,7 @@ static void tnt_add_checksum(char *sentence) #ifdef __UNUSED__ else { gpsd_report(session->context->debug, LOG_ERROR, - "Bad TNT sentence: '%s'\n", sentence); + "Bad TNT sentence: '%s'\n", msg); } #endif /* __UNUSED__ */ while (((c = *p) != '\0')) { @@ -709,18 +711,8 @@ static void tnt_add_checksum(char *sentence) p++; } (void)snprintf(p, 6, "*%02X\r\n", (unsigned int)sum); -} - - -static ssize_t tnt_control_send(struct gps_device_t *session, - char *msg, size_t len UNUSED) -/* send a control string in TNT native formal */ -{ - ssize_t status; - tnt_add_checksum(msg); - status = write(session->gpsdata.gps_fd, msg, strlen(msg)); - (void)tcdrain(session->gpsdata.gps_fd); + status = gpsd_write(session, msg, strlen(msg)); return status; } -- cgit v1.2.1