Jiri Benc
2013-03-21 19:04:36 UTC
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;
}
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
1.7.6.5