On Fri, Nov 12, 2021 at 10:27:06AM -0600, Ed Branch wrote: > On 11/11/21 17:28, Ed Branch wrote: > > > > Thanks for the quick reply. Understood, digging this out properly (ie. > > finding the /sys/class/ptp/ptp*/dev file with a matching minor to that > > of the device node) would add a lot of complexity. However, looking at > > the alloc_chardev_region() call in the ptp driver > > (drivers/ptp/ptp_clock.c) reveals the first minor in the requested range > > is always 0, so it might be ok to assume the PHC index is just the > > device node minor. > > > > Of course your suggestion of just ignoring the failure in phc2sys would > > be enough to fix my use case too. > > > > Thanks again for looking at this, > > - Ed Branch > > Reading a bit further into posix_clock_open(...), I see it already relied on > existence of device nodes named "/dev/ptp#". If these have to exist anyway > then maybe there's no point accounting for other names. My actual failure is > because I access them through a symlink created by udev based on the > clock_name sysfs attribute. So simply resolving symlinks prior to the > existing logic would also work. > > For now, my workaround is to rename the symlinks so they do not match the > "/dev/ptp*" pattern.
What is your use case for the char device symlinks exactly? The canonical way of finding the PTP char device corresponding to an interface is to use "ethtool -T eth0 | grep 'PTP Hardware Clock'". _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users