1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 17:43:09 +02: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); restrict_usb_path(arg);
dev = open_usb(USB_VENDOR, USB_PRODUCT); dev = open_usb(USB_VENDOR, USB_PRODUCT);
if (!dev) { 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; return NULL;
} }
res = usb_claim_interface(dev, 0); res = usb_claim_interface(dev, 0);
if (res == -EPERM) {
fprintf(stderr,
"Permission denied. You may need to become root.\n");
return NULL;
}
if (res) { if (res) {
fprintf(stderr, "usb_claim_interface: %d\n", res); fprintf(stderr, "usb_claim_interface: %d\n", res);
return NULL; return NULL;