summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2010-07-31 00:29:28 -0700
committerGary E. Miller <gem@rellim.com>2010-07-31 00:29:28 -0700
commit30dc2ec3d95c042b80c55b117c36f63d87d80b99 (patch)
treeed38c5ac8082abe39d7420c1295181f8a2a58898
parent2039f5363920919ad71ac682a9f0891fe264ad44 (diff)
downloadgpsd-30dc2ec3d95c042b80c55b117c36f63d87d80b99.tar.gz
More kernel_pps. Fine tune the config for another required header.
Start of code to dynamically pick the right kernel PPS edge.
-rw-r--r--configure.ac2
-rw-r--r--libgpsd_core.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f448f01b..9281214b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -686,6 +686,8 @@ AC_MSG_CHECKING([for PPS time syncing support])
if test x"$ac_pps" = "xyes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([PPS_ENABLE], 1, [PPS time syncing support])
+ AC_CHECK_HEADERS(pps.h)
+ dnl timepps.h needs pps.h
AC_CHECK_HEADERS(timepps.h)
else
AC_MSG_RESULT([no])
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 1cef6f87..589be08f 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -257,6 +257,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
gpsd_report(LOG_PROG, "PPS Create Thread gpsd_ppsmonitor\n");
#if defined(HAVE_TIMEPPS_H)
+ int kpps_edge = 0; /* 0 = assert edge, 1 = clear edge */
pps_info_t pi;
int kernelpps_handle = init_kernel_pps( session );
if ( 0 <= kernelpps_handle ) {
@@ -429,9 +430,15 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
if (0 != ok) {
#if defined(HAVE_TIMEPPS_H)
if ( 0 <= kernelpps_handle ) {
- /* ntpshm_pps() expects usec, not nsec */
- pi.clear_timestamp.tv_nsec /= 1000;
- (void)ntpshm_pps(session, (struct timeval*)&pi.clear_timestamp);
+ /* pick the right edge */
+ if ( kpps_edge ) {
+ /* ntpshm_pps() expects usec, not nsec */
+ pi.clear_timestamp.tv_nsec /= 1000;
+ (void)ntpshm_pps(session, (struct timeval*)&pi.clear_timestamp);
+ } else {
+ pi.assert_timestamp.tv_nsec /= 1000;
+ (void)ntpshm_pps(session, (struct timeval*)&pi.assert_timestamp);
+ }
} else
#endif
(void)ntpshm_pps(session, &tv);