summaryrefslogtreecommitdiff
path: root/ppsthread.c
Commit message (Collapse)AuthorAgeFilesLines
* LICENSE: Update licenses for consistency. No functional changes.Gary E. Miller2018-11-191-2/+2
|
* ppsthread.c: fix typo in comment, no functional change.Gary E. Miller2018-10-181-1/+1
|
* PPS: rejected -> ignored.Gary E. Miller2017-09-191-1/+1
| | | | | | | Many people confuse rejecting the trainling PPS edge as rejecting the entire PPS pulse. Change reject to ignore to soften the blow. Still needs more clarity.
* Clean up C and Python code-checker warnings.Eric S. Raymond2017-09-061-0/+1
|
* Rasberry -> Raspberry, thanks to Péter <e2qb2a44f@prolan-power.hu>Gary E. Miller2017-01-251-3/+3
|
* Initial creation of os_compat.h.Fred Wright2017-01-221-0/+1
| | | | | | | | | | | | | | | | | This creates a header for os_compat.c, and moves the related prototypes into it from gpsd_config.h (as created by SConstruct), after adding references to it to gpsd.h (via gpsd.h-tail) and a few other sources that need it but don't include gpsd.h. It also removes includes of <time.h> in the places where they were only needed for the code now removed from gpsd_config.h. TESTED: Ran "scons build-all check" on OSX 10.9 (with strlcat/strlcpy but no clock_gettime), OSX 10.12 (with strlcat/strlcpy and clock_gettime), and Ubuntu 14 (with clock_gettime but no strlcat/strlcpy). Also verified that fallback versions were not being included where unnecessary.
* Adds Linux "fake PPS" detection and avoidance.Fred Wright2016-12-231-9/+49
| | | | | | | | | | | | | | | | | | | | | If the Linux kernel is built with CONFIG_PPS_CLIENT_KTIMER=y, then a synthetic PPS source is added to allow testing without a real PPS source. However, this source doesn't even run at exactly 1Hz, so any attempt to use it for real time synchronization is disastrous. To make matters worse, this is usually the first PPS driver configured, causing it to appear as /dev/pps0, which is the implied PPS device used by the "Magic HAT" kludge. This change adds detection for the fake source (based on its name), both to provide a warning if it is configured explicitly, and to skip over it when applying the "Magic HAT" kludge. TESTED: Tested both gpsmon and gpsd on a Beaglebone Black with added symlinks for testing "Magic HAT". Did this with kernels with and without the KTIMER enabled. Verified that the proper PPS device is selected by "Magic HAT", and that a warning is generated when expected.
* Fixes various flakiness in PPS handling.Fred Wright2016-09-281-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The pps_thread_activate() code uses a single structure to pass information to the monitor thread. The latter copies the data during its initialization, so there's no long-term conflict across threads, but there's no guarantee that the thread runs and gets far enough to do that before the structure is reused. Note that this bug is fairly unlikely to affect a multicore machine unless it's heavily loaded, but easily causes trouble on a single-core machine. A variety of strange PPS misbehaviors were observed on a Beaglebone Black in the presence of this bug, including various nonreproducible PPS initialization problems and failures, and duplicate PPS reports. This change uses the pps_thread field as a flag to communicate a "copy acknowledgment" back to pps_thread_activate(), which waits for it before proceeding. TESTED: Launched several times on a Beaglebone Black with KPPS support, and no longer observed flaky PPS startup in the logs, as well as no longer observing duplicate PPS events in gpsmon. Not tested on other platforms due to the lack of PPS availability. Signed-off-by: Gary E. Miller <gem@rellim.com>
* Update PPS comments and constantsGary E. Miller2016-06-151-23/+50
| | | | | | | Now that ntpshmmon works better, ppsthread can use better constants. Add comments on why the PPS constants are what they are.
* Fix a KPPS log mistakenly marked PPS.Gary E. Miller2016-05-061-1/+1
|
* Tweak log messages for when timepps.h not found.Gary E. Miller2016-05-051-3/+6
| | | | This might solve a common problem.
* Fix yet another fatal typo. Apparently I'm still asleep.Eric S. Raymond2016-04-251-1/+1
|
* Fix fatal typo in previous commit.Eric S. Raymond2016-04-251-1/+1
|
* Add message to nail down timing of /dev/ppsX opening vs. privilege dropEric S. Raymond2016-04-251-1/+2
|
* Improve the test for TIOMCIWAIT, log it better.Gary E. Miller2016-04-241-3/+4
| | | | If the file descriptor is negative, no way it can be a tty.
* Coverity cleanup.Eric S. Raymond2016-03-281-1/+1
|
* state_last_tio was never set, so edge detection not working.Haakan Johansson2016-03-161-0/+2
|
* cycle and duration became long long in ebb1d9da, use %lld.Haakan Johansson2016-03-151-3/+3
|
* Close bug #45083: ppsthread.c:1091: erroneous rejection of PPS?Gary E. Miller2016-01-041-2/+3
| | | | | | | | Anonymous found a bug in my logic... This would have caused rejection of valid PPS pulses in the length of 1.00 Sec to 1.100 Sec, and the inclusion of bad PPS of length 1.101 Sec to 1.999 Sec.
* Make KPPS logging a bit less alarmist.Gary E. Miller2015-08-181-3/+6
| | | | | | Failure to get a time stamp is not an error, at worst it is a WARN and at best an INFO. Since some GPS do not emit PPS when they have no time lock it is just a state with no valid time.
* Remove duplicate header include - it moved later to pacify OpenBSD.Eric S. Raymond2015-07-111-1/+0
|
* Fix overflow issue on 32 bit binaries.Gary E. Miller2015-06-031-4/+4
| | | | | | | | | Timespec is a 62 bit number, it does not fit in the 32 bits of a long. Use 'long long' instead. 'long long' is always at least 64 bits long and is the same as a native int when compiled as 64 bit. Note that many 64 bit OS still run 32 bit binaries, and many small devices like RasPi's are 32 bit.
* More trailing whitespace fixups.Gary E. Miller2015-04-301-9/+9
|
* Tweak a log message, to separate call and return vars.Gary E. Miller2015-04-011-2/+2
|
* Move the calculation back into "Stage Three: Calculation"Gary E. Miller2015-04-011-1/+7
| | | | This cancels the change that broke a lot of logging.
* Eliminate some duplication code for timespec arithmetic.Eric S. Raymond2015-04-011-47/+1
|
* Stop making the assumption that device cycle time is 1 second in ppsthread.c.Eric S. Raymond2015-04-011-9/+3
| | | | | | | | Instead, pass out real time of last PPS as it was actually seen. We can then correct it using the device's actual cycle time. The correction currently only works for cycle times that are integral multiples of a second.
* Increase consistency of names. No code changes.Eric S. Raymond2015-04-011-1/+1
|
* Further thread-monitor interface simplification.Eric S. Raymond2015-04-011-2/+0
| | | | | | Remove the wrap hook. The only thing it was doing was closing the chrony fd. which can be done just as cleanly by whatever calls the pps_thread_deactivate() function.
* Clean up PPS monitor interface with renames, and additional documentation.Eric S. Raymond2015-04-011-7/+7
|
* Thread monitor interface simplification.Eric S. Raymond2015-04-011-5/+1
| | | | | | With a bit of refactoring we can eliminate one of the hooks. PPS observed live, telnetting to localhost:2947 with gpsd running.
* pps_canwait needs to be visible in TIOCCMIWAIT case.Eric S. Raymond2015-03-311-1/+1
|
* Comment polishing.Eric S. Raymond2015-03-311-5/+7
|
* In ppsthread.c, two structure memberrs can be hidden a bit more.Eric S. Raymond2015-03-311-1/+1
|
* remove some duplicate code by using new innner_context_tGary E. Miller2015-03-311-50/+25
| | | | pps_canwait and pps_caps now persistent.
* KPPS now reads /dev/ppsX, but is missing last_fixtime.Gary E. Miller2015-03-311-11/+24
| | | | | Also some commment on why ppsthread uses a 10% detection window on what would seemingly be a 1e-3 or 1e-9 quantity.
* Information hiding. Move kernelpps_handle out of thread-context structure...Eric S. Raymond2015-03-311-109/+87
| | | | | | ...stash it in an inner context. PPS observed live on GR601-W.
* Separate invisible pulse detection from unchanged detection.Gary E. Miller2015-03-311-8/+11
| | | | | The old code broke invisible pulse on 5Hz and 0.5 Hz PPS. Also did not catch many of the chattering modes.
* ppsthread.[ch] and timespec_str.c are now fully detached from the rest of GPSD.Eric S. Raymond2015-03-311-2/+6
| | | | | | This means they could be dropped into NTP or another time-service program. The only requirement is to set -DHAVE_SYS_TIMEPPS_H if you want the RFC2783 code compiled in.
* Loosen ppsthread.c's ties to the rest of GPSD.Eric S. Raymond2015-03-311-8/+14
| | | | | | | | | Soon, being able to drop it into NTP may be valuable. The only remaining adhesion is that it needs gpsd_config.h for the status of HAVE_SYS_TIMEPPS_H. No code changes.
* Add a lot of comments about PPS logic, Clean up an indent.Gary E. Miller2015-03-301-120/+210
|
* Stupid typo in KPPS logic. TPPS was running when KPPS was good.Gary E. Miller2015-03-301-1/+2
|
* Fix segfault from botched log message.Gary E. Miller2015-03-301-2/+2
|
* Be consistent about not says uSec.Gary E. Miller2015-03-301-1/+1
|
* clang found a real bug, don't mask the bug.Gary E. Miller2015-03-301-2/+0
|
* Remove stray ok = false;Gary E. Miller2015-03-301-2/+0
|
* Write scan-build suppressions to it runs clean.Eric S. Raymond2015-03-301-38/+11
| | | | | | Promote scan-build to be onere of the stock pre-release checks. Fix one minor cppcheck nit.
* One line fix to PPS w/o KPPS not working.Gary E. Miller2015-03-301-46/+59
| | | | Plus a ton of logging tweaks
* Plain english edge description.Gary E. Miller2015-03-301-8/+12
|
* Typo, THREAD_INF not THREAD_INFOGary E. Miller2015-03-301-1/+2
|