summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Gembe <derago@gmail.com>2019-08-02 13:32:21 +0700
committerNathan Hjelm <hjelmn@google.com>2019-08-09 09:13:11 -0700
commitb8152378e02bee3373f2f134b6a13373d641221f (patch)
tree6d20bbc66baa1edc3f768d89d43b5ccc8bed1de6
parent02b79819b3a3b33fd2e45a4743c515930351f59f (diff)
downloadlibusb-b8152378e02bee3373f2f134b6a13373d641221f.tar.gz
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>
-rw-r--r--libusb/os/windows_winusb.c11
-rw-r--r--libusb/version_nano.h2
2 files changed, 11 insertions, 2 deletions
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 @@ static int composite_open(int sub_api, struct libusb_device_handle *dev_handle)
}
}
- 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