diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2016-04-25 17:09:32 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-04-25 17:13:51 -0400 |
commit | f8f474ed00294d943fe04b7bbd83ca3a9f6580f9 (patch) | |
tree | e033c693f5d99de9fcae70a2eb3d8f9b1887ab2f /timehint.c | |
parent | 7329c9234fe2a8c2e0452e1995bb6aae6178cc6f (diff) | |
download | gpsd-f8f474ed00294d943fe04b7bbd83ca3a9f6580f9.tar.gz |
Autoconfiguration kluge for Raspberry Pi.
When a serial device to be opened is /dev/ttyAMA0, and /dev/pps0 exists,
and we have read-write access to it (which implies running as root),
substitute /dev/pps0 for the device name in the thread context so we
use KPPS.
Should be safe because /dev/ttyAMA0 is so specific to the Raspberry Pi.
Diffstat (limited to 'timehint.c')
-rw-r--r-- | timehint.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -442,6 +442,14 @@ void ntpshm_link_activate(struct gps_device_t *session) } else { init_hook(session); session->pps_thread.report_hook = report_hook; + /* + * 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. + */ + if (strcmp(session->pps_thread.devicename, "/dev/ttyAMA0") == 0 + && access("/dev/pps0", R_OK | W_OK) == 0) + session->pps_thread.devicename = "/dev/pps0"; pps_thread_activate(&session->pps_thread); } } |