fx2lafw: Made libusb_claim_interface error messages more informative

This commit is contained in:
Joel Holdsworth 2012-06-27 21:39:26 +01:00 committed by Uwe Hermann
parent 88a13f30bd
commit 0c156e06c5
1 changed files with 15 additions and 1 deletions

View File

@ -495,7 +495,21 @@ static int hw_dev_open(int dev_index)
ret = libusb_claim_interface(ctx->usb->devhdl, USB_INTERFACE);
if (ret != 0) {
sr_err("fx2lafw: Unable to claim interface: %d.", ret);
switch(ret) {
case LIBUSB_ERROR_BUSY:
sr_err("fx2lafw: Unable to claim USB interface. Another "
"program or driver has already claimed it.");
break;
case LIBUSB_ERROR_NO_DEVICE:
sr_err("fx2lafw: Device has been disconnected.");
break;
default:
sr_err("fx2lafw: Unable to claim interface: %d.", ret);
break;
}
return SR_ERR;
}