]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Made libusb_claim_interface error messages more informative
authorJoel Holdsworth <redacted>
Wed, 27 Jun 2012 20:39:26 +0000 (21:39 +0100)
committerUwe Hermann <redacted>
Wed, 27 Jun 2012 22:40:48 +0000 (00:40 +0200)
hardware/fx2lafw/fx2lafw.c

index 2e88241ecfec61e0b17f71b5a4972172fcf578cf..2b8f1c34e25aafa3d8e483ee9b268d8dc841aa6a 100644 (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;
        }