gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] magic_hat on FreeBSD


From: Jail Bird
Subject: [gpsd-dev] magic_hat on FreeBSD
Date: Thu, 2 Aug 2018 23:27:04 -0500

I've been using a build that somewhat follows "Stratum-1-Microserver
HOWTO" on a RPi3 for a few months, except I've been using
FreeBSD/arm64 with the normal pps-gpio.dtbo overlay.

I'm not sure if it makes sense or not, but I reused the 'magic_hat'
configuration setting from Linux for this using the below patch:

--- SConstruct 2017-09-07 06:50:30.000000000 -0500
+++ SConstruct 2018-08-02 22:54:42.853973000 -0500
@@ -193,11 +193,11 @@ boolopts = (
     ("nostrip",       False, "don't symbol-strip binaries at link time"),
     ("manbuild",      True,  "build help in man and HTML formats"),
     ("leapfetch",     True,  "fetch up-to-date data on leap seconds."),
     ("minimal", False, "turn off every option not set on the command line"),
     ("timeservice",   False, "time-service configuration"),
-    ("magic_hat", sys.platform.startswith('linux'),
+    ("magic_hat", sys.platform.startswith('linux') or
sys.platform.startswith('freebsd'),
      "special Linux PPS hack for Raspberry Pi et al"),
     ("xgps",          True,  "include xgps and xgpsspeed."),
     # Test control
     ("slow",          False, "run tests with realistic (slow) delays"),
 )
@@ -871,16 +871,25 @@ else:
             else:
                 confdefs.append("#define %s \"%s\"\n" % (key.upper(), value))

     # Simplifies life on hackerboards like the Raspberry Pi
     if env['magic_hat']:
-        confdefs.append('''\
+        if sys.platform.startswith('linux'):
+            confdefs.append('''\
 /* Magic device which, if present, means to grab a static /dev/pps0 for KPPS */
 #define MAGIC_HAT_GPS "/dev/ttyAMA0"
 /* Generic device which, if present, means: */
 /* to grab a static /dev/pps0 for KPPS */
 #define MAGIC_LINK_GPS "/dev/gpsd0"
+''')
+        elif sys.platform.startswith('freebsd'):
+            confdefs.append('''\
+/* Magic device which, if present, means to grab a static /dev/pps0 for KPPS */
+#define MAGIC_HAT_GPS "/dev/ttyu0"
+/* Generic device which, if present, means: */
+/* to grab a static /dev/pps0 for KPPS */
+#define MAGIC_LINK_GPS "/dev/gpiopps0"
 ''')

     confdefs.append('''\

 #define GPSD_CONFIG_H
--- ppsthread.c 2017-09-06 16:58:23.000000000 -0500
+++ ppsthread.c 2018-08-02 23:05:12.282176000 -0500
@@ -194,11 +194,16 @@ char *pps_get_first(void)
 {
     if (pps_check_fake("pps0"))
  return "/dev/pps1";
     return "/dev/pps0";
 }
-#endif /* __linux__ */
+#else  /* not __linux__ */
+char *pps_get_first(void)
+{
+    return MAGIC_LINK_GPS;
+}
+#endif

 static int init_kernel_pps(struct inner_context_t *inner_context)
 /* return handle for kernel pps, or -1; requires root privileges */
 {
     pps_params_t pp;

-JailBird



reply via email to

[Prev in Thread] Current Thread [Next in Thread]