From 1e6a169431484ea7a412a76234d0790819e8f124 Mon Sep 17 00:00:00 2001 From: Delio Brignoli Date: Wed, 5 Sep 2012 13:40:21 +0200 Subject: [PATCH] Do not expect or open a /dev/ptpX device when in free_running mode Signed-off-by: Delio Brignoli --- clock.c | 4 +++- ptp4l.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clock.c b/clock.c index 459b7b9..eeefd39 100644 --- a/clock.c +++ b/clock.c @@ -402,7 +402,9 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, if (c->nports) clock_destroy(c); - if (phc_index >= 0) { + if (c->dds.free_running) { + c->clkid = CLOCK_INVALID; + } else if (phc_index >= 0) { snprintf(phc, 31, "/dev/ptp%d", phc_index); c->clkid = phc_open(phc); if (c->clkid == CLOCK_INVALID) { diff --git a/ptp4l.c b/ptp4l.c index 12bb3f3..6fc210a 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -247,7 +247,9 @@ int main(int argc, char *argv[]) } /* determine PHC Clock index */ - if (*timestamping == TS_SOFTWARE || *timestamping == TS_LEGACY_HW) { + if (ds->free_running) { + phc_index = -1; + } else if (*timestamping == TS_SOFTWARE || *timestamping == TS_LEGACY_HW) { phc_index = -1; } else if (req_phc) { if (1 != sscanf(req_phc, "/dev/ptp%d", &phc_index)) {