On Fri,  6 Mar 2020 11:23:00 -0800, Richard Cochran wrote:
> +int phc_number_pins(clockid_t clkid)
> +{
> +     struct ptp_clock_caps caps;
> +
> +     if (phc_get_caps(clkid, &caps)) {
> +             return 0;
> +     }
> +#ifdef HAVE_PIN_SETFUNC
> +     return caps.n_pins;
> +#else
> +     return 0;
> +#endif
> +}
> +
> +int phc_pin_setfunc(clockid_t clkid, struct ptp_pin_desc *desc)
> +{
> +     int err = -EOPNOTSUPP;
> +#ifdef HAVE_PIN_SETFUNC
> +     err = ioctl(CLOCKID_TO_FD(clkid), PTP_PIN_SETFUNC2, desc);
> +     if (err) {
> +             fprintf(stderr, PTP_PIN_SETFUNC_FAILED "\n");
> +     }
> +#endif
> +     return err;

If I'm reading the patches correctly, this would require a rebuild if
the kernel is updated in order for linuxptp to use the new kernel
functions.

It would be better to detect this at run time instead, allowing
linuxptp to use the best interface dynamically without recompiling. It
seems to be doable, the old kernels return -ENOTTY for unknown commands.

Thanks,

 Jiri



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

Reply via email to