Do not expect or open a /dev/ptpX device when in free_running mode

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
master
Delio Brignoli 2012-09-05 13:40:21 +02:00
parent 6c54c31dca
commit 1e6a169431
2 changed files with 6 additions and 2 deletions

View File

@ -402,7 +402,9 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
if (c->nports) if (c->nports)
clock_destroy(c); 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); snprintf(phc, 31, "/dev/ptp%d", phc_index);
c->clkid = phc_open(phc); c->clkid = phc_open(phc);
if (c->clkid == CLOCK_INVALID) { if (c->clkid == CLOCK_INVALID) {

View File

@ -247,7 +247,9 @@ int main(int argc, char *argv[])
} }
/* determine PHC Clock index */ /* 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; phc_index = -1;
} else if (req_phc) { } else if (req_phc) {
if (1 != sscanf(req_phc, "/dev/ptp%d", &phc_index)) { if (1 != sscanf(req_phc, "/dev/ptp%d", &phc_index)) {