-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libusb_get_bos_descriptor() fails to check for bcdUSB > 0x0200 before querying device for BOS descriptor #1492
Comments
Does the standard disallow devices with bcdUSB <= 0x0200 to have a BOS descriptor? I am not sure if libusb should stand in the way if a user wants to request a BOS descriptor. We should maybe make our use of libusb_get_bos_descriptor() in xusb and testlibusb conditional on bcdUSB. |
Good idea. |
The "Binary device Object Store" (BOS) descriptor was introduced with bcdUSB revision 0x0201. References #1492 Signed-off-by: Tormod Volden <[email protected]>
It was already tested for in testlibusb. I added the same check in xusb. The question remains whether we should map pipe error in libusb_get_bos_descriptor() to LIBUSB_ERROR_NOT_FOUND if bcdUSB < 0x0201. |
It is my (hopefully correct) understanding that only USB 2.0 LPM and later standards (bcdUSB > 0x0200) require devices to support BOS descriptor query. However, the libusb function
libusb_get_bos_descriptor()
does not contain logic to first check the bcdUSB value is high enough, and therefore still queries devices with bcdUSB <= 0x0200 for a BOS descriptor.For older USB 1.0 or USB 2.0 (not LPM) devices, the descriptor type = 0x0f could be undefined and requesting it could cause abnormal device behavior and the library could return LIBUSB_ERROR_TIMEOUT or LIBUSB_ERROR_PIPE when it should be returning LIBUSB_ERROR_NOT_FOUND according to the doxygen comment.
Some background:
https://techcommunity.microsoft.com/t5/microsoft-usb-blog/usb-2-1-2-0-1-1-device-enumeration-changes-in-windows-8/ba-p/270775
https://microchip.my.site.com/s/article/Does-a-USB2-1-Specification-Exist
The text was updated successfully, but these errors were encountered: