On Tue, Nov 02, 2021 at 01:34:01AM +0200, Vladimir Oltean wrote:
> On Mon, Nov 01, 2021 at 03:56:38AM -0700, Richard Cochran wrote:
> > On Mon, Nov 01, 2021 at 11:19:15AM +0200, Vladimir Oltean wrote:
> > 
> > > For what it's worth, I have solved both my problems (checking ptp4l sync
> > > and phc2sys sync) through alternative methods,
> > 
> > How did you do it?
> 
> For checking ptp4l sync I wrote my own PTP management message handling
> over the local AF_UNIX socket and I am querying the CURRENT_DATA_SET.
> For checking phc2sys sync I shamelessly stole the relevant logic from
> phc2sys (read_phc/sysoff_measure), including the various PTP_SYS_OFFSET_*
> ioctls, and I am just calculating the PHC's offset to CLOCK_REALTIME.
> 
> So both of these are local. Then I created some communication protocol
> in my application (sender and receiver roles) so that the sender queries
> the receiver about its local sync data, and then has the logic necessary
> to figure out whether now is a good time to send or not.

Since it's GPL code that I shamelessly stole, it might be nice to also
share the source code here (in case somebody else looking to solve the
same problem wants to shamelessly steal mine):
https://github.com/vladimiroltean/tsn-scripts/tree/master/isochron
The relevant files are ptpmon.c (for ptp4l monitoring) and sysmon.c
(for phc2sys monitoring).


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to