Discussion:
[Linuxptp-devel] [PATCH] hwstamp_ctl: explain ERANGE error better
Jiri Benc
2013-03-21 19:04:36 UTC
Permalink
ERANGE is used by the kernel to indicate the hardware does not support the
requested time stamping mode. Explain this error to the user.

Signed-off-by: Jiri Benc <***@redhat.com>
---
hwstamp_ctl.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hwstamp_ctl.c b/hwstamp_ctl.c
index 4f1683a..456d96b 100644
--- a/hwstamp_ctl.c
+++ b/hwstamp_ctl.c
@@ -139,10 +139,14 @@ int main(int argc, char *argv[])
}

err = ioctl(fd, SIOCSHWTSTAMP, &ifreq);
- if (err < 0)
+ if (err < 0) {
+ err = errno;
perror("SIOCSHWTSTAMP failed");
+ if (err == ERANGE)
+ fprintf(stderr, "The requested time stamping mode is not supported by the hardware.\n");
+ }

printf("tx_type %d\n" "rx_filter %d\n", cfg.tx_type, cfg.rx_filter);

- return err ? errno : 0;
+ return err;
}
--
1.7.6.5
Richard Cochran
2013-03-24 15:26:59 UTC
Permalink
Post by Jiri Benc
ERANGE is used by the kernel to indicate the hardware does not support the
requested time stamping mode. Explain this error to the user.
---
hwstamp_ctl.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Applied.

Thanks,
Richard

Loading...