summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorReinhard Arlt <reinhard.arlt@t-online.de>2013-10-03 17:10:19 +0300
committerReinhard Arlt <reinhard.arlt@t-online.de>2013-10-03 17:10:19 +0300
commitad872d0dbc32c2ec0e3c0f5ed56a461ea7f7fd91 (patch)
tree2083197c2f5f501bdd143165908c1ed9c46f7746 /drivers.c
parent6f5ddf288d296deb670ae214f9345aa2280b6b1f (diff)
parent73352206caf3e3dc9881e5e2bf788076653c4fce (diff)
downloadgpsd-ad872d0dbc32c2ec0e3c0f5ed56a461ea7f7fd91.tar.gz
Merge branch 'master' of git://git.sv.gnu.org/gpsd
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers.c b/drivers.c
index 0602b208..6c458458 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;
}