summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct8
-rw-r--r--gpsmon.c9
2 files changed, 13 insertions, 4 deletions
diff --git a/SConstruct b/SConstruct
index 3bfb95ab..61cb905b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -778,6 +778,14 @@ else:
announce("Forcing pps=no (neither TIOCMIWAIT nor RFC2783 API is available)")
env["pps"] = False
+ # This works for the Raspberry Pi. Someday, configure more interlligently
+ # for workalikes like the ODROID C2.
+ confdefs.append('''\
+/* Magic device which, if present, means to grab a static /dev/pps0 for KPPS */
+#define MAGIC_HAT_GPS "/dev/ttyAMA0"
+''')
+
+
confdefs.append('''\
/* Some libcs do not have strlcat/strlcpy. Local copies are provided */
#ifndef HAVE_STRLCAT
diff --git a/gpsmon.c b/gpsmon.c
index 8a35138e..99b97788 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -1297,11 +1297,12 @@ int main(int argc, char **argv)
if (session.sourcetype == source_rs232 || session.sourcetype == source_usb) {
session.pps_thread.report_hook = pps_report;
/*
- * The Raspberry Pi kludge. If we're using /dev/ttyAMA0,
- * and there is a static /dev/pps0, and we have access because
- * we're root, assume we want to use KPPS.
+ * The HAT kludge. If we're using the HAT GPS on a
+ * Raspberry Pi or a workalike like the ODROIDC2, and
+ * there is a static /dev/pps0, and we have access because
+ * we're root, assume we want to use KPPS.
*/
- if (strcmp(session.pps_thread.devicename, "/dev/ttyAMA0") == 0
+ if (strcmp(session.pps_thread.devicename, MAGIC_HAT_GPS) == 0
&& access("/dev/pps0", R_OK | W_OK) == 0)
session.pps_thread.devicename = "/dev/pps0";
pps_thread_activate(&session.pps_thread);