https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238412

            Bug ID: 238412
           Summary: libusb_get_config_descriptor() should return
                    LIBUSB_NOT_FOUND on out-of-range config_index
           Product: Base System
           Version: 11.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 204897
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=204897&action=edit
proposed patch

libusb_get_config_descriptor() in FreeBSD issues a get_config_descriptor       
request even if the config_index argument is out of range.  On the other       
hand, the function in Linux checks the config_index argument against           
bNumConfigurations in the device descriptor and returns LIBUSB_ERROR_NOT_FOUND 
without issuing get_config_descriptor requests.                                

It seems that get_config_descriptor requests with invalid config_index         
values for most USB devices fail, but there is a device (USB DrDAQ from        
Pico Technology) that does not check the config_index value.  The request      
for USB DrDAQ succeeds even if the config_index value is invalid.              
As a result, the behavior of libusb_get_config_descriptor() in FreeBSD         
differs from the one in Linux on such a device.                                
This makes qemu hang on FreeBSD with USB passthrough enabled because qemu      
repeats libusb_get_config_descriptor() with incrementing config_index until    
the function returns an error.

The specification of libusb_get_config_descriptor():                           
 
http://libusb.sourceforge.net/api-1.0/group__libusb__desc.html#gaa635d9aec77d\e4895dd0896ccf001532
The implementation in Linux:
  https://github.com/libusb/libusb/blob/v1.0.22/libusb/descriptor.c#L625

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[email protected]"

Reply via email to