After a USB device has been removed I can (try to) send a USB packet using libusb_bulk_transfer(). The program then blocks instead of returning an error.
I get the logs:
LIBUSB_FUNCTION: libusb_bulk_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer leave 0
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter
LIBUSB_FUNCTION: libusb10_handle_events_sub enter
I added the dev and pxfer* logs.
Then the program is blocked until I kill it using Ctrl-C.
Under GNU/Linux libusb_bulk_transfer() returns the error LIBUSB_ERROR_NO_DEVICE.
Maybe libusb_bulk_transfer() or libusb_submit_transfer() would check the USB device is still present.
I can test patches. The problem is easy to reproduce for me.
I propose the attached patch.
It works for me.
Created attachment 197049 [details]
Check the USB device is still present
See updated patch on Bug 231076 .
*** This bug has been marked as a duplicate of bug 231076 ***