Windows: Workaround for composite devices with U2F on Win10 1903
authorAxel Gembe <derago@gmail.com>
Fri, 2 Aug 2019 06:32:21 +0000 (13:32 +0700)
committerNathan Hjelm <hjelmn@google.com>
Fri, 9 Aug 2019 16:13:11 +0000 (09:13 -0700)
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>
libusb/os/windows_winusb.c
libusb/version_nano.h

index 19b605a..d500a6d 100644 (file)
@@ -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;
 }
 
index 5469eb2..a9137ea 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11380
+#define LIBUSB_NANO 11381