Re: [Linuxptp-users] Regression - phc2sys fails with certain PHC char dev filenames
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
|
From: Ed B. <br...@ar...> - 2021-11-11 23:28:12
|
On 11/11/21 16:34, Vladimir Oltean wrote: > That would be me and my ts2phc patches. Sorry for that. Prior to that > change, posix_clock_open() used to simply not populate *phc_index when > passed a path to a PHC. I don't think there's any kernel API to deduce > the PHC number using ioctls on the char device itself, so for my use > case it would be pretty odd to have a PTP device named differently than > /dev/ptpN. Nonetheless, phc2sys does not need to know the exact number > of the PTP clock, and therefore, what I can do is move the error one > level upper, at the caller. I'll try to come up with a patch tomorrow. > 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 |