The capability command for phc_ctl does not display the number of pins
or the cross timestamping support. Add this as output so that the user
can see the complete device capabilities.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
On some platforms, time_t has recently switched from "long" to "long
long" [1]. For these platforms it is necessary to use "%lld" as printf
format specifier because the ABI differs between "long" and "long long".
I found no way for creating something similar to PRId64 for time_t. No
idea how to determine whether it's "long" or "long long". So I cast
everything to "long long" instead.
[1] https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51
Signed-off-by: Christian Eggers <ceggers@arri.de>
The one user of the function, posix_clock_open(), simply open codes
the closing call to phc_close(). This patch provides a method to
balance closing and opening of a posix clock. In addition, the
phc_ctl program never explicitly closed the opened clock, and so this
patch adds the missing call.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The two programs, phc2sys and phc_ctl, use nearly identical subroutines to
open an instance of a dynamic posix clock. In anticipation of yet a third
program with similar needs, this patch refactors the common code into the
utilities.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The kernel supports different PTP_SYS_OFFSET* ioctls. Use the sysoff
enum to allow selecting between them in sysoff_measure().
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
When parsing the argument, the minimum value should be -DBL_MAX instead
of DBL_MIN, which is the smallest positive value.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This is an updated version of a script I wrote a couple years ago for
debugging the PHC when writing a new driver. I figured that it might be
handy for the LinuxPTP project to include, as it can give some insight
into the PHC directly. I have updated it to make use of the shared code
here, in order to reduce duplication. Hopefully this is of some use to
everyone.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>