From 79c69b2b12e5f8ee3aa3f50b8886a0a7bbdd73f7 Mon Sep 17 00:00:00 2001 From: Fred Wright Date: Thu, 22 Dec 2016 17:32:45 -0800 Subject: Makes MAGIC_HAT kludge optional. This adds a build option called 'magic_hat', and makes the code for MAGIC_HAT_GPS and MAGIC_LINK_GPS conditional on it. It currently defaults to True on Linux and False otherwise. It's meaningless on non-Linux platforms, though at present there are no conditionally-present options, so this one is also present on all platforms. TESTED: Tested on a Beaglebone Black with suitable symlinks added (and running a kernel with PPS_CLIENT_KTIMER turned off. Verified that the kludge behaves as intended when enabled, and is inoperative when disabled. --- gpsmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gpsmon.c') diff --git a/gpsmon.c b/gpsmon.c index 724e4cc4..9a02ef62 100644 --- a/gpsmon.c +++ b/gpsmon.c @@ -1318,6 +1318,7 @@ int main(int argc, char **argv) /* this guard suppresses a warning on Bluetooth devices */ if (session.sourcetype == source_rs232 || session.sourcetype == source_usb) { session.pps_thread.report_hook = pps_report; + #ifdef MAGIC_HAT_ENABLE /* * The HAT kludge. If we're using the HAT GPS on a * Raspberry Pi or a workalike like the ODROIDC2, and @@ -1326,8 +1327,9 @@ int main(int argc, char **argv) */ if ((strcmp(session.pps_thread.devicename, MAGIC_HAT_GPS) == 0 || strcmp(session.pps_thread.devicename, MAGIC_LINK_GPS) == 0) - && access("/dev/pps0", R_OK | W_OK) == 0) - session.pps_thread.devicename = "/dev/pps0"; + && access("/dev/pps0", R_OK | W_OK) == 0) + session.pps_thread.devicename = "/dev/pps0"; + #endif /* MAGIC_HAT_GPS && MAGIC_LINK_GPS */ pps_thread_activate(&session.pps_thread); } #endif /* PPS_ENABLE */ -- cgit v1.2.1