mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-19 07:06:16 +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);
|
restrict_usb_path(arg);
|
||||||
dev = open_usb(USB_VENDOR, USB_PRODUCT);
|
dev = open_usb(USB_VENDOR, USB_PRODUCT);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
if (errno == EPERM)
|
||||||
|
fprintf(stderr, "Permission denied. "
|
||||||
|
"You may need to become root.\n");
|
||||||
|
else
|
||||||
fprintf(stderr, ":-(\n");
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user