Re: [Linuxptp-devel] [RFC PATCH 01/15] posix_clock_open: derive PHC index from device name if possible

2020-08-12 Thread Keller, Jacob E



> -Original Message-
> From: Richard Cochran 
> Sent: Wednesday, August 12, 2020 8:40 AM
> To: Keller, Jacob E 
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [RFC PATCH 01/15] posix_clock_open: derive PHC
> index from device name if possible
> 
> On Wed, Aug 05, 2020 at 04:12:02PM -0700, Jacob Keller wrote:
> > Here, we are making the implicit assumption that all ptp clock devices
> > will always have /dev/ptpX format. I don't think anyone is crazy enough
> > to rename these devices...
> 
> (Not yet, anyways  ;^)
> 
> > An alternative (requiring kernel implementation maybe?) would be to read
> > the phc index from the kernel somehow. It doesn't look like this is
> > exported anywhere else besides the name.
> 
> How about /sys/class/ptp/ptpX/clock_index ?
> 
> Is that something you would like to code up for the lkml?
> 
> Thanks,
> Richard

To make this fully work we'll probably want to adjust the LinuxPTP code base 
with a phc_index_to_dev function that scans the sys/class/ptp folder for the 
matching clock based on the index to obtain the name. I'll see about adding 
that as well (with a fallback to attempting /dev/ptpX if clock_index doesn't 
exist)

Thanks,
Jake


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


Re: [Linuxptp-devel] [RFC PATCH 01/15] posix_clock_open: derive PHC index from device name if possible

2020-08-12 Thread Keller, Jacob E
> -Original Message-
> From: Richard Cochran 
> Sent: Wednesday, August 12, 2020 8:40 AM
> To: Keller, Jacob E 
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: Re: [Linuxptp-devel] [RFC PATCH 01/15] posix_clock_open: derive PHC
> index from device name if possible
> 
> On Wed, Aug 05, 2020 at 04:12:02PM -0700, Jacob Keller wrote:
> > Here, we are making the implicit assumption that all ptp clock devices
> > will always have /dev/ptpX format. I don't think anyone is crazy enough
> > to rename these devices...
> 
> (Not yet, anyways  ;^)
> 
> > An alternative (requiring kernel implementation maybe?) would be to read
> > the phc index from the kernel somehow. It doesn't look like this is
> > exported anywhere else besides the name.
> 
> How about /sys/class/ptp/ptpX/clock_index ?
> 
> Is that something you would like to code up for the lkml?
> 
> Thanks,
> Richard

Yea, I can do that.

-Jake


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


Re: [Linuxptp-devel] [RFC PATCH 01/15] posix_clock_open: derive PHC index from device name if possible

2020-08-12 Thread Richard Cochran
On Wed, Aug 05, 2020 at 04:12:02PM -0700, Jacob Keller wrote:
> Here, we are making the implicit assumption that all ptp clock devices
> will always have /dev/ptpX format. I don't think anyone is crazy enough
> to rename these devices...

(Not yet, anyways  ;^)

> An alternative (requiring kernel implementation maybe?) would be to read
> the phc index from the kernel somehow. It doesn't look like this is
> exported anywhere else besides the name.

How about /sys/class/ptp/ptpX/clock_index ?

Is that something you would like to code up for the lkml?

Thanks,
Richard


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