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 <jbenc@redhat.com>
master
Jiri Benc 2013-03-21 20:04:36 +01:00 committed by Richard Cochran
parent bd28acffb3
commit fb1b781413
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}