File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -698,6 +698,9 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
698698 int j , k ;
699699
700700 int res = libusb_get_device_descriptor (dev , & desc );
701+ if (res < 0 )
702+ continue ;
703+
701704 unsigned short dev_vid = desc .idVendor ;
702705 unsigned short dev_pid = desc .idProduct ;
703706
@@ -1089,11 +1092,20 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
10891092
10901093 libusb_get_device_list (usb_context , & devs );
10911094 while ((usb_dev = devs [d ++ ]) != NULL && !good_open ) {
1095+ struct libusb_device_descriptor desc ;
10921096 struct libusb_config_descriptor * conf_desc = NULL ;
10931097 int j ,k ;
10941098
1095- if (libusb_get_active_config_descriptor (usb_dev , & conf_desc ) < 0 )
1099+ res = libusb_get_device_descriptor (usb_dev , & desc );
1100+ if (res < 0 )
10961101 continue ;
1102+
1103+ res = libusb_get_active_config_descriptor (usb_dev , & conf_desc );
1104+ if (res < 0 )
1105+ libusb_get_config_descriptor (usb_dev , 0 , & conf_desc );
1106+ if (!conf_desc )
1107+ continue ;
1108+
10971109 for (j = 0 ; j < conf_desc -> bNumInterfaces && !good_open ; j ++ ) {
10981110 const struct libusb_interface * intf = & conf_desc -> interface [j ];
10991111 for (k = 0 ; k < intf -> num_altsetting && !good_open ; k ++ ) {
You can’t perform that action at this time.
0 commit comments