Windows: Workaround for composite devices with U2F on Win10 1903
On Windows 10 version 1903 and later Windows blocks attempts to open
HID devices with a U2F usage unless running as administrator. This
patch makes the composite_open function ignore when opening the HID
part of a composite device fails.
Closes #603
Signed-off-by: Axel Gembe <derago@gmail.com>
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c
index 19b605a..d500a6d 100644
--- a/libusb/os/windows_winusb.c
+++ b/libusb/os/windows_winusb.c
@@ -4115,9 +4115,18 @@
}
}
- if (available[SUB_API_MAX]) // HID driver
+ if (available[SUB_API_MAX]) { // HID driver
r = hid_open(SUB_API_NOTSET, dev_handle);
+ // On Windows 10 version 1903 (OS Build 18362) and later Windows blocks attempts to
+ // open HID devices with a U2F usage unless running as administrator. We ignore this
+ // failure and proceed without the HID device opened.
+ if (r == LIBUSB_ERROR_ACCESS) {
+ usbi_dbg("ignoring access denied error while opening HID interface of composite device");
+ r = LIBUSB_SUCCESS;
+ }
+ }
+
return r;
}
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 5469eb2..a9137ea 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11380
+#define LIBUSB_NANO 11381