From fb1b781413f065c4d38172aa2fadf233670ecff7 Mon Sep 17 00:00:00 2001 From: Jiri Benc Date: Thu, 21 Mar 2013 20:04:36 +0100 Subject: [PATCH] hwstamp_ctl: explain ERANGE error better 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 --- hwstamp_ctl.c | 8 ++++++-- 1 file 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; }