diff options
-rw-r--r-- | libgpsd_core.c | 4 | ||||
-rw-r--r-- | timehint.c | 23 |
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; } @@ -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; |