summaryrefslogtreecommitdiff
path: root/timehint.c
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-12-22 17:32:45 -0800
committerFred Wright <fw@fwright.net>2016-12-22 17:32:45 -0800
commit79c69b2b12e5f8ee3aa3f50b8886a0a7bbdd73f7 (patch)
tree4144ed2bf859363b996af60e1ae3dcaec69da875 /timehint.c
parentd1fd9ad44f320235b4d449988570ab5633f21bab (diff)
downloadgpsd-79c69b2b12e5f8ee3aa3f50b8886a0a7bbdd73f7.tar.gz
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.
Diffstat (limited to 'timehint.c')
-rw-r--r--timehint.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/timehint.c b/timehint.c
index 3ca03120..fc5d397a 100644
--- a/timehint.c
+++ b/timehint.c
@@ -459,6 +459,7 @@ void ntpshm_link_activate(struct gps_device_t *session)
} else {
init_hook(session);
session->pps_thread.report_hook = report_hook;
+ #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
@@ -467,8 +468,9 @@ void ntpshm_link_activate(struct gps_device_t *session)
*/
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);
}
}