mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-12-22 23:22:25 +02:00
tools/lib/atusb-common.c (atusb_open): give more detailed error message on EPERM
This commit is contained in:
parent
e549ee4911
commit
1615375dce
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user