Use the same logic to get the config descriptor in hid_open() as in hid_enumerate()
authorSam Lantinga <slouken@libsdl.org>
Mon, 25 Nov 2019 16:29:12 -0800
changeset 13290d470fa5477b7
parent 13289 42c6ff45c3e1
child 13291 1fa66206f89f
Use the same logic to get the config descriptor in hid_open() as in hid_enumerate()
src/hidapi/libusb/hid.c
     1.1 --- a/src/hidapi/libusb/hid.c	Mon Nov 25 15:02:54 2019 -0800
     1.2 +++ b/src/hidapi/libusb/hid.c	Mon Nov 25 16:29:12 2019 -0800
     1.3 @@ -940,7 +940,10 @@
     1.4  		int i,j,k;
     1.5  		libusb_get_device_descriptor(usb_dev, &desc);
     1.6  
     1.7 -		if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0)
     1.8 +		res = libusb_get_active_config_descriptor(usb_dev, &conf_desc);
     1.9 +		if (res < 0)
    1.10 +			libusb_get_config_descriptor(usb_dev, 0, &conf_desc);
    1.11 +		if (!conf_desc)
    1.12  			continue;
    1.13  		for (j = 0; j < conf_desc->bNumInterfaces; j++) {
    1.14  			const struct libusb_interface *intf = &conf_desc->interface[j];