This patch adds support to hwtstamp_ctl for obtaining the current
settings of the device, if the feature is supported. This can be useful
for debugging what mode the device/driver thinks its in.

Signed-off-by: Jacob Keller <[email protected]>
---
 hwstamp_ctl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hwstamp_ctl.c b/hwstamp_ctl.c
index 456d96b09147..cca18422fb50 100644
--- a/hwstamp_ctl.c
+++ b/hwstamp_ctl.c
@@ -84,11 +84,12 @@ int main(int argc, char *argv[])
        struct hwtstamp_config cfg;
        char *device = NULL, *progname;
        int c, err, fd, rxopt = HWTSTAMP_FILTER_NONE, txopt = HWTSTAMP_TX_OFF;
+       int getcfg = 0;
 
        /* Process the command line arguments. */
        progname = strrchr(argv[0], '/');
        progname = progname ? 1+progname : argv[0];
-       while (EOF != (c = getopt(argc, argv, "hi:r:t:v"))) {
+       while (EOF != (c = getopt(argc, argv, "hi:r:t:vg"))) {
                switch (c) {
                case 'i':
                        device = optarg;
@@ -99,6 +100,9 @@ int main(int argc, char *argv[])
                case 't':
                        txopt = atoi(optarg);
                        break;
+               case 'g':
+                       getcfg = 1;
+                       break;
                case 'v':
                        version_show(stdout);
                        return 0;
@@ -138,7 +142,7 @@ int main(int argc, char *argv[])
                return -1;
        }
 
-       err = ioctl(fd, SIOCSHWTSTAMP, &ifreq);
+       err = ioctl(fd, getcfg ? SIOCGHWTSTAMP : SIOCSHWTSTAMP, &ifreq);
        if (err < 0) {
                err = errno;
                perror("SIOCSHWTSTAMP failed");
-- 
1.9.0


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to