summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-03-31 15:10:04 -0700
committerGary E. Miller <gem@rellim.com>2015-03-31 15:10:04 -0700
commit89ba451e0a76682e5a1b499f894d1b21b6e38198 (patch)
tree241fad00a9608fe967e192c46a0aebc164911dc8
parent60aa77a844b8a0a95053d8425e21d2a7bc6cf2b6 (diff)
downloadgpsd-89ba451e0a76682e5a1b499f894d1b21b6e38198.tar.gz
Another small step to /dev/ppsX. ppsthread now looping fine, no time yet.
-rw-r--r--libgpsd_core.c4
-rw-r--r--timehint.c23
2 files changed, 19 insertions, 8 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a674ae9d..58bdc805 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -554,6 +554,10 @@ int gpsd_activate(struct gps_device_t *session, const int mode)
// cppcheck-suppress pointerLessThanZero
if (session->gpsdata.gps_fd < 0) {
/* return could be -1, PLACEHOLDING_FD, of UNALLOCATED_FD */
+ if ( PLACEHOLDING_FD == session->gpsdata.gps_fd ) {
+ /* it is /dev/ppsX, need to set devicename, etc. */
+ gpsd_clear(session);
+ }
return session->gpsdata.gps_fd;
}
diff --git a/timehint.c b/timehint.c
index 33d9f8b3..c0502d61 100644
--- a/timehint.c
+++ b/timehint.c
@@ -408,21 +408,28 @@ void ntpshm_link_activate(struct gps_device_t *session)
if (session->sourcetype == source_pty)
return;
- /* allocate a shared-memory segment for "NMEA" time data */
- session->shm_clock = ntpshm_alloc(session->context);
+ if (session->sourcetype != source_pps ) {
+ /* allocate a shared-memory segment for "NMEA" time data */
+ session->shm_clock = ntpshm_alloc(session->context);
+
+ if (session->shm_clock == NULL) {
+ gpsd_log(&session->context->errout, LOG_WARN,
+ "NTPD: ntpshm_alloc() failed\n");
+ return;
+ }
+ }
- if (session->shm_clock == NULL) {
- gpsd_log(&session->context->errout, LOG_INF,
- "NTPD ntpshm_alloc() failed\n");
#if defined(PPS_ENABLE)
- } else if (session->sourcetype == source_usb || session->sourcetype == source_rs232) {
+ if (session->sourcetype == source_usb
+ || session->sourcetype == source_rs232
+ || session->sourcetype == source_pps) {
/* We also have the 1pps capability, allocate a shared-memory segment
* for the 1pps time data and launch a thread to capture the 1pps
* transitions
*/
if ((session->shm_pps = ntpshm_alloc(session->context)) == NULL) {
- gpsd_log(&session->context->errout, LOG_INF,
- "NTPD ntpshm_alloc(1) failed\n");
+ gpsd_log(&session->context->errout, LOG_WARN,
+ "PPS: ntpshm_alloc(1) failed\n");
} else {
init_hook(session);
session->pps_thread.report_hook = report_hook;