1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-07-01 03:18:54 +03:00

tools/lib/atusb-common.c (atusb_open): give more detailed error message on EPERM

This commit is contained in:
Werner Almesberger 2011-07-05 00:17:20 -03:00
parent e549ee4911
commit 1615375dce

View File

@ -62,11 +62,20 @@ void *atusb_open(const char *arg)
restrict_usb_path(arg);
dev = open_usb(USB_VENDOR, USB_PRODUCT);
if (!dev) {
fprintf(stderr, ":-(\n");
if (errno == EPERM)
fprintf(stderr, "Permission denied. "
"You may need to become root.\n");
else
fprintf(stderr, ":-(\n");
return NULL;
}
res = usb_claim_interface(dev, 0);
if (res == -EPERM) {
fprintf(stderr,
"Permission denied. You may need to become root.\n");
return NULL;
}
if (res) {
fprintf(stderr, "usb_claim_interface: %d\n", res);
return NULL;