Hi,

I am writing some software that needs to access the PTP hardware clock 
directly. The system clock is not set up to be synchronised to PTP.
I have found from the documentation that I can do this by opening /dev/ptpn, 
converting the device ID to a clock ID and calling clock_gettime().

The network card containing the desired PTP clock is defined by the user of the 
software using the Linux network card interface name. This name is written to 
/etc/ptp4l.conf.

I have found that I can extract this name from ptp4l.conf using grep and can 
then call ethtool to provide the PTP Hardware Clock number, n.
I am then fairly certain that the associated PTP hardware clock device path is 
/dev/ptpn.

I can also read the name of the directory in /sys/class/net/<interface 
name>/device/ptp, to get the PTP device path associated with the interface, 
avoiding the need to use ethtool.

Is there a better way to find the PTP device path for a network interface based 
on its name? In particular, is there a library that I can include in some C/C++ 
code that I can call to resolve the device path from the interface name?

Best Regards,

Tony May


::DISCLAIMER:: E-mail communication is confidential and intended solely for the 
addressee(s). Any unauthorized review, use, disclosure or distribution is 
prohibited. If you believe the e-mail message has been sent to you in error, 
please notify the sender by replying to the e-mail transmission and delete the 
message without disclosing it. Thank you.
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to