]> err.no Git - yubikey-personalization.old/commitdiff
_ykusb_open_device: Detach kernel HID driver.
authorFredrik Thulin <fredrik@yubico.com>
Thu, 30 Dec 2010 19:42:46 +0000 (20:42 +0100)
committerFredrik Thulin <fredrik@yubico.com>
Thu, 30 Dec 2010 19:42:46 +0000 (20:42 +0100)
This avoids the

  USB error: could not claim interface 0: Device or resource busy

when linking with libusb-0.1 - at least on Ubuntu 10.04.

ykcore/ykcore_libusb.c

index 8d8c83539d54ba5c43ae340a5521387ec6041a07..287b5acdad4b9a3ac1da447e9c845c1fbf6a9a46 100644 (file)
@@ -159,6 +159,8 @@ void *_ykusb_open_device(int vendor_id, int product_id)
                            && dev->descriptor.idProduct == YUBIKEY_PID) {
                                rc = YK_EUSBERR;
                                h = usb_open(dev);
+                               if (h != NULL)
+                                       usb_detach_kernel_driver_np(h, 0);
                                goto done;
                        }
        }