From 532164366e4596cf86aefb4fc99ffdaffa438da0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 25 Nov 2019 16:29:12 -0800 Subject: [PATCH] Use the same logic to get the config descriptor in hid_open() as in hid_enumerate() --- src/hidapi/libusb/hid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index 180e3aeb1..b44e886bf 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -940,7 +940,10 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) int i,j,k; libusb_get_device_descriptor(usb_dev, &desc); - if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0) + res = libusb_get_active_config_descriptor(usb_dev, &conf_desc); + if (res < 0) + libusb_get_config_descriptor(usb_dev, 0, &conf_desc); + if (!conf_desc) continue; for (j = 0; j < conf_desc->bNumInterfaces; j++) { const struct libusb_interface *intf = &conf_desc->interface[j];