From: Joel Holdsworth Date: Wed, 27 Jun 2012 20:39:26 +0000 (+0100) Subject: fx2lafw: Made libusb_claim_interface error messages more informative X-Git-Tag: dsupstream~896 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0c156e06c55a5b69385778fb00292d5866660a7f;p=libsigrok.git fx2lafw: Made libusb_claim_interface error messages more informative --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 2e88241e..2b8f1c34 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -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; }