From: Klas Lindfors Date: Thu, 16 Aug 2012 12:14:23 +0000 (+0200) Subject: do usb_set_configuration(h, 1) before we use the YubiKey X-Git-Tag: v1.8.0~84 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c86f0c578a3975edaaceba2a7ca80a288977b763;p=yubikey-personalization do usb_set_configuration(h, 1) before we use the YubiKey Needed for some configurations, at least virtualbox. fixes #14. --- diff --git a/ykcore/ykcore_libusb-1.0.c b/ykcore/ykcore_libusb-1.0.c index 138e85c..d1d7105 100644 --- a/ykcore/ykcore_libusb-1.0.c +++ b/ykcore/ykcore_libusb-1.0.c @@ -172,6 +172,10 @@ void *_ykusb_open_device(int vendor_id, int product_id) if (ykl_errno != 0) goto done; ykl_errno = libusb_detach_kernel_driver(h, 0); + if (ykl_errno != 0) + goto done; + /* This is needed for yubikey-personalization to work inside virtualbox virtualization. */ + ykl_errno = libusb_set_configuration(h, 1); goto done; } } diff --git a/ykcore/ykcore_libusb.c b/ykcore/ykcore_libusb.c index fb8f17e..deb70e4 100644 --- a/ykcore/ykcore_libusb.c +++ b/ykcore/ykcore_libusb.c @@ -163,6 +163,9 @@ void *_ykusb_open_device(int vendor_id, int product_id) if (h != NULL) usb_detach_kernel_driver_np(h, 0); #endif + /* This is needed for yubikey-personalization to work inside virtualbox virtualization. */ + if (h != NULL) + usb_set_configuration(h, 1); goto done; } }