diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-10-26 16:38:53 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-10-26 16:38:53 +0000 |
commit | 0ad0dbab0d5a5b0d52bdcd1998a71b7eb924a5e3 (patch) | |
tree | 5a9a5a5ade1559c1ec4a50fc991a0a0069bc461a | |
parent | b537f434152cf2b07bd48a9b92a38df26db85780 (diff) | |
download | gpsd-0ad0dbab0d5a5b0d52bdcd1998a71b7eb924a5e3.tar.gz |
Recognize use of @ as a private packet leader character...
...which both the True North and the Sony CXD2951 do. It shouldn't be
included in the packet checksum. This enables us to get rid of the
separate tnt_send() function.
Note: this changes, very slightly, gpsd's behavior with respect to
Sony CXD2951 chips -- there is an initializer string in drivers.c
that used to *include* the @ in its checksum. I suspect this was a
bug, but I'm noting it here in case I just broke the support for that
chip.
-rw-r--r-- | nmea_parse.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nmea_parse.c b/nmea_parse.c index 2c46e537..cd3be39f 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -669,7 +669,11 @@ int nmea_send(int fd, const char *fmt, ... ) va_start(ap, fmt) ; (void)vsnprintf(buf, sizeof(buf)-5, fmt, ap); va_end(ap); - if (fmt[0] == '$') { + /* + * @ is used as a private leader character by some devices, + * like the True North magnetic compass and the Sony CXD2951. + */ + if (fmt[0] == '$' || fmt[0] == '@') { (void)strlcat(buf, "*", BUFSIZ); nmea_add_checksum(buf); } else |