summaryrefslogtreecommitdiff
path: root/gpsdecode.c
Commit message (Collapse)AuthorAgeFilesLines
* LICENSE: Update licenses for consistency. No functional changes.Gary E. Miller2018-11-191-1/+1
|
* Savannah issue #53671: policy_t -> gps_policy_t.Gary E. Miller2018-07-261-2/+2
| | | | | | This is to prevent a conflict with Boost version 1.67. No functional change.
* SPDXify the licerse references.Eric S. Raymond2018-03-081-1/+1
|
* uint was rmoved in C99. If gpsd enforce C99, then uint must go.Gary E. Miller2016-08-151-39/+39
| | | | uint is now unsigned int.
* Address bug #46802: AIVDM to CSV is broken in some weird casesFred Wright2016-01-041-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying the regression tests on a MacBook (PowerPC), I ran across some failures in the "Testing AIVDM decoding w/ CSV format" test. The failing type/dac/fid cases were as follows: 6,1,14 6,1,18 6,1,30 6,1,32 8,200,10 The proximate cause is endian dependence in the CSV output, but the real problem turns out to be that the code is broken on all platforms, but only fails on big-endian platforms because the incorrect-but-presumed-correct output was captured on a little-endian processor. The problem arises when the type 6 or type 8 case is supported by the AIVDM parser but not by the CSV formatter. When the parser doesn't support the case, it falls back to capturing the raw binary bitdata. When the formatter doesn't support the case, it falls back to dumping the raw binary bitdata. But in the offending cases, the raw data was never correctly captured, and is instead an overlaid view of the structured data, which is incorrect (as raw data) in all cases as well as being endian-sensitive due to the presence of multibyte quantities in host byte order. The only way to make the CSV fallback work as intended would be to change the struct ais_t type6 and type8 substructure definitions to move the bitdata field out of the union and populate it unconditionally. But this would increase the memory footprint and add to the core code for the sole purpose of providing more useful output in these cases of missing CSV formatting support, which doesn't seem very justifiable. The alternative is simply not to report the unavailable raw bitdata at all in these cases, but instead to report something indicating that the raw data is unknown. I've implemented a version of this where the formatting remains the same (including the bit count) but the hex data is replaced by "x" characters (which seemed safer than using "?", given the absence of the latter in any existing cases. After implementing the code change and before updating the test data, I saw one additional miscompare that I'd not seen on the PPC. This was for the 6,1,12 case, where the existing test data is too incomplete to populate the endian-sensitive fields in the decoded form, but which would have failed with a better version of the test case. After updating the test data as well as the code, the test passes on both x86_64 and PPC. P.S.: There are three additional uses of gpsd_hexdump in the CSV output, for types 17, 25, and 26, but those all seem to populate the bidata field unconditionally (and type 17 doesn't even have a "structured" flag), so I left them alone. Clearly the right fix would be to implement the missing CSV formatting cases, which would render the fallback code unreachable, but it could become reachable again if new cases were implemented in the parser and not in the CSV formatter, so having a well-behaved fallback seems like a good idea.
* Retire splint from our set of static analyzers.Eric S. Raymond2015-03-301-8/+0
| | | | | | | | | | | | | | | | | | | The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
* Use LOG_* symbol when setting/comparing log levelZbigniew Chyla2015-03-221-1/+1
| | | | | Currently, debug level 0 is actually LOG_SHOUT. This change doesn't affect generated binary code.
* cppcheck and Coverity cleanup; all regression tests pass.Eric S. Raymond2015-02-091-1/+1
|
* splint cleanup. All regressiion tests pass.Eric S. Raymond2015-02-091-1/+1
|
* Back out the attempt to use VTIME.Eric S. Raymond2015-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to Matthias Drochner at http://lists.lysator.liu.se/pipermail/lsh-bugs/2003q4/000151.html: I thought I'd give lsh a try, just to see how it compares to openssh... The client didn't work well on NetBSD, got a message like "unexpected EWOULDBLOCK" on each keystroke. Looked a bit deeper and found that stdin is set to O_NONBLOCK and a raw tty mode with c_cc[VMIN] > 1 and c_cc[VTIME] > 0. I'll append a little test program which does the same. I've tried it on 3 operating systems (Linux, NetBSD, Digital UNIX), and it behaves differently on each: -on Linux, if a key is pressed, the read returns immediately with that one character -on NetBSD, the read returns with no data but EWOULDBLOCK -on D'UNIX, the poll() doesn't teturn before 4 keypresses are done; the read() returns these 4 characters Indeed, in SUSv2's termios page is a sentence which says that if both O_NONBLOCK and VTIME>0 are set, the behaviour is more or less undefined. I've solved my immediate problems by setting VMIN to 1 instead of 4 in unix_interact.c:do_make_raw(), but VTIME is still pointless, so I wouldn't call this a clean solution. All regression tests pass.
* splint cleanup for gpsdecode -m implementation.Eric S. Raymond2015-01-291-2/+2
|
* Add gpsdecode -m option for dumping minimum packet lengths.Eric S. Raymond2015-01-291-1/+31
|
* Easy splint cleanups. All regression tests pass.Eric S. Raymond2015-01-211-1/+1
|
* Add str_{,v}appendf, use it everywhere.Zbigniew Chyla2015-01-211-51/+38
| | | | This change doesn't affect generated binary code.
* Add -n option to gpsdecode to dump pseudo-NMEA.Eric S. Raymond2014-09-221-3/+41
| | | | | | Required for testing the changes related to saellide-data representation. All regression tests pass.
* Make -D option of gpsdecode effective again.Eric S. Raymond2014-09-181-5/+4
|
* Magic-number elimination. All regression tests pass.Eric S. Raymond2014-09-121-5/+6
|
* Minimal option requires conditionalization of some code.Eric S. Raymond2014-09-061-0/+2
| | | | | All regression tests pass with default options (GPS tests are disabled with minimal on, because socket_export is off).
* splint/cppcheck cleanuo after the gpsd_report change.Eric S. Raymond2014-08-271-4/+3
| | | | All regression tests pass.
* Reverse linkage of gpsd_report() is abolished. All regression tests pass.Eric S. Raymond2014-08-271-11/+6
| | | | Some cleanup and testing is still required.
* Structure member name change: packet -> lexer. No logic changes.Eric S. Raymond2014-08-271-5/+5
| | | | All regression tests pass.
* Eliminate reverse linkage of gpsd_write. All regression tests pass.Eric S. Raymond2014-08-261-8/+0
|
* Allow gpsedecode to dump SKY reports.Eric S. Raymond2014-08-251-1/+2
|
* Make interpretation of the split24 flag propperly per-subscriber.Eric S. Raymond2013-11-101-1/+7
| | | | | | | | This involved moving some out of the AIS driver. There is a related small change in behavior; now, if split24 is on, the Type B half of a matched pair will be shipped with type 'both'. All regression tests pass. PPS is live.
* Make all hex-dumping truly thread-safe.Eric S. Raymond2013-10-131-5/+11
|
* We can now monitor low-level string sends through gpsmon.Eric S. Raymond2013-10-041-0/+8
| | | | Now we'll know exactly what's being sent on a UBX mode change.
* Properly label debug reports from different programs.Eric S. Raymond2013-09-291-0/+11
| | | | All regression tests pass.
* Change gpsd_report to no longer use a global. All regression tests pass.Eric S. Raymond2013-09-291-16/+0
| | | | | | | | This is a large, ugly change. But without it we can't troubleshoot the ICP/IP-source initialization bug properly - colliding definitions of gpsd_report() were interfering with error reporting early in gpsd runs. More cleanup work remains to be done, but at least this is working.
* Extract ITU-R 1371-4 model and serial fields from AIS Type24 messages.Eric S. Raymond2013-09-151-1/+7
| | | | | | | | | | | | | | In ITU-R 1371-4, there are new model and serial fields carved out of the right-hand end of vendorid, which is reduced from 7 chars to 3. It is not clear in which minor revision this change took place. To cope with older AIS implementations, unpack the trailing bits *both* ways; truly revision-4-conformant implementations will have up to four characters of trailing garbage on the vendorid, and older implementations will have garbafe in the model and serial fields. This commit also reverts the change to copy only 20 characters rather than 21 when analyzing the name field in a type21. There's some mystery about why this didn't break the rgression tests sooner.
* Split Type 24 reporting, including the -s option to gpsdecode.Eric S. Raymond2013-09-141-1/+7
| | | | All regression tests pass.
* Nuke trailing whitespace in C source.Eric S. Raymond2012-09-071-11/+11
|
* Replace exit({0,1}) with exit(EXIT_{SUCCESS,FAILURE})Eric S. Raymond2012-09-071-5/+5
| | | | Note there are some exit(2) instances we bneed to decide what to do with.
* splint indicated yet another followup to the waterlevel signedness fix in AIS.Eric S. Raymond2012-07-021-1/+1
|
* [AIS] Fix plenty of small bugs unveiled by aishub test campaign.Christian Gagneraud2012-06-201-2/+14
| | | | | | | | | | | | | | | | | | | | | | A test campaign was run with live data from aishub.net (ca. 25 millions sentence, 1.2 GB of logs), the goal was to check the decoding and the JSON parsing and dumping code. On all the AIS data, the following tests were done: - AIVDM decoding - JSON scaled dump - JSON validity check on scaled dump. - JSON unscaled dump - JSON validity check on unscaled dump - JSON unscaled idempotency check - JSON unscaled/scaled idempotency check The last check consisted of: - parsing the unscaled dump - dumping it back in scaled mode - compare it with the original scaled dump. This test campaign has unveiled plenty of small bugs all around the AIS code. This patch fixes all of them and adds new sentences in the regression tests.
* gpsdecode: honor scale flagChristian Gagneraud2012-06-201-0/+4
| | | | | | | Currently gpsdecode doesn't care about the -u (unscaled) flag. Fix that. This patch will allow aivdm-regress to run tests in scaled mode. scons check passed.
* [AIS] Do scaling/offset operations only in json dumpChristian Gagneraud2012-06-051-1/+1
| | | | splint and check pass.
* [AIS] Met/Hydro: fixes and improvementsChristian Gagneraud2012-06-051-0/+41
|
* Clean up a couple of string-format errors. All regression tests pass.Eric S. Raymond2012-06-021-2/+2
|
* [AIS] Add UK/ROI AtoN monitoring data message handlingChristian Gagneraud2012-05-231-5/+28
|
* Appease splint, which can't parse declarations after executable code.Eric S. Raymond2012-05-211-3/+3
|
* [AIS] Use a dedicated stucture for IMO236 met/hydro messageChristian Gagneraud2012-05-201-5/+56
|
* More Coverity-spawned fixes. All regression tests pass.Eric S. Raymond2012-05-091-2/+3
|
* Improve error messages.Eric S. Raymond2012-03-041-0/+6
|
* const and splint cleanup.Eric S. Raymond2011-10-091-4/+5
|
* Ensure that enabling timing won't break object file compatibility.Eric S. Raymond2011-10-091-1/+1
|
* A step towards fixing the socket_export=no build.Eric S. Raymond2011-08-261-3/+13
|
* Make gpsdecode interpret "Date:" comments. All regression tests pass.Eric S. Raymond2011-06-231-0/+2
|
* Make gpsdecode initialize its time context the same way gpsd does.Eric S. Raymond2011-06-231-0/+1
|
* Elimination of gpsd_hexdump_level.Eric S. Raymond2011-06-171-1/+0
| | | | The few gpsd_hexdump() calls left have explicit guards.
* Bug fixed, all regression tests now pass with PASSTHROUGH_ENABLED.Eric S. Raymond2011-06-151-2/+2
|