]> err.no Git - yubikey-personalization/commitdiff
do usb_set_configuration(h, 1) before we use the YubiKey
authorKlas Lindfors <klas@yubico.com>
Thu, 16 Aug 2012 12:14:23 +0000 (14:14 +0200)
committerKlas Lindfors <klas@yubico.com>
Thu, 16 Aug 2012 12:14:23 +0000 (14:14 +0200)
Needed for some configurations, at least virtualbox. fixes #14.

ykcore/ykcore_libusb-1.0.c
ykcore/ykcore_libusb.c

index 138e85c2e9b0dbb1597687129febe9754647bec4..d1d71057e948c52331dc3ff4ce122b34e692fc58 100644 (file)
@@ -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;
                }
        }
index fb8f17ea11ae8dc8d213ba4474bd1140d2263bbf..deb70e41c5d7ba5279fd2bf3435e374634b790e0 100644 (file)
@@ -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;
                        }
        }