luxonis / XLink

A cross-platform library for communicating with devices over various physical links.
Apache License 2.0
11 stars 17 forks source link

workaround libusb bug in `libusb_free_device_list(ptr, 1)` #69

Open diablodale opened 1 year ago

diablodale commented 1 year ago

libusb_free_device_list(ptr, 1) does not handle the scenario of having null entries in the device list. It will errantly stop its unref walk of the list thinking it has reached the terminating null. https://github.com/libusb/libusb/issues/1287

Fix now in my fork of Xlink. Will auto link to the commit below.

tormodvolden commented 1 year ago

The question is why would there be a null entry in this list (other than the terminating null - it is a null-terminated list). The code in usb_host.cpp looks fine, it retrieves the list, iterates over it and frees it without modifying it.

Can you please use an assert instead of "continue" here? https://github.com/luxonis/XLink/blob/d209b7eeb8ac68435df5097e57e1dfd8ea1d0e83/src/pc/protocols/usb_host.cpp#L126

tormodvolden commented 1 year ago

I was looking in the wrong file. wrap_libusb.hpp is a lot more scary.

diablodale commented 1 year ago

@tormodvolden, do you have a bug to report? If so, please open a new bug with: description, setup, repro steps, actual results, and expected results.