From b8152378e02bee3373f2f134b6a13373d641221f Mon Sep 17 00:00:00 2001 From: Axel Gembe Date: Fri, 2 Aug 2019 13:32:21 +0700 Subject: 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 Signed-off-by: Nathan Hjelm --- libusb/os/windows_winusb.c | 11 ++++++++++- libusb/version_nano.h | 2 +- 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 -- cgit v1.2.1