From: Fredrik Thulin Date: Thu, 7 Apr 2011 18:03:48 +0000 (+0200) Subject: Slot 2 configuration was broken with libusb-win32. X-Git-Tag: v1.5.1~14 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91998e5683ad3785d1df81c1ef8d26509c908221;p=yubikey-personalization.old Slot 2 configuration was broken with libusb-win32. Reading status reports with slot 2 did not work with libusb-win32 (1.0.8) for some reason, while working just fine on Linux and Mac OS X. --- diff --git a/ykcore/ykcore.c b/ykcore/ykcore.c index 88aff0e..8a07331 100644 --- a/ykcore/ykcore.c +++ b/ykcore/ykcore.c @@ -223,7 +223,6 @@ int yk_write_config(YK_KEY *yk, YK_CONFIG *cfg, int confnum, * This wait can't be done in yk_write_to_key since some users of that function * want to get the bytes in the status message, but when writing configuration * we don't expect any data back. - * */ yk_wait_for_key_status(yk, slot, 0, WAIT_FOR_WRITE_FLAG, false, SLOT_WRITE_FLAG, NULL); @@ -336,6 +335,14 @@ int yk_wait_for_key_status(YK_KEY *yk, uint8_t slot, unsigned int flags, int slept_time = 0; int blocking = 0; + /* Non-zero slot breaks on Windows (libusb-1.0.8-win32), while working fine + * on Linux (and probably MacOS X). + * + * The YubiKey doesn't support per-slot status anyways at the moment (2.2), + * so we just set it to 0 (meaning slot 1). + */ + slot = 0; + while (slept_time < max_time_ms) { /* Read a status report from the key */ memset(data, 0, sizeof(data));