From e2471ddd5934d24dff6802bdbe4b38e83878cc01 Mon Sep 17 00:00:00 2001 From: Fred Wright Date: Thu, 22 Dec 2016 19:47:25 -0800 Subject: Adds Linux "fake PPS" detection and avoidance. 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. --- ppsthread.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ppsthread.h') diff --git a/ppsthread.h b/ppsthread.h index b37e739c..3d5f696e 100644 --- a/ppsthread.h +++ b/ppsthread.h @@ -53,5 +53,7 @@ extern void pps_thread_fixin(volatile struct pps_thread_t *, volatile struct timedelta_t *); extern int pps_thread_ppsout(volatile struct pps_thread_t *, volatile struct timedelta_t *); +int pps_check_fake(const char *); +char *pps_get_first(void); #endif /* PPSTHREAD_H */ -- cgit v1.2.1