Bug 231322 - libusb_bulk_transfer() does not fail (with LIBUSB_ERROR_NO_DEVICE) if the device is not more present
Summary: libusb_bulk_transfer() does not fail (with LIBUSB_ERROR_NO_DEVICE) if the dev...
Status: Closed DUPLICATE of bug 231076
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-12 09:08 UTC by Ludovic Rousseau
Modified: 2018-09-12 13:32 UTC (History)
1 user (show)

See Also:


Attachments
Check the USB device is still present (640 bytes, patch)
2018-09-12 09:51 UTC, Ludovic Rousseau
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic Rousseau 2018-09-12 09:08:07 UTC
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
dev: 0x28c09b80
pxfer0: 0x28c2f0f0
pxfer1: 0x28c2f12c
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.
Comment 1 Ludovic Rousseau 2018-09-12 09:50:35 UTC
I propose the attached patch.
It works for me.
Comment 2 Ludovic Rousseau 2018-09-12 09:51:06 UTC
Created attachment 197049 [details]
Check the USB device is still present
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2018-09-12 10:37:16 UTC
See updated patch on Bug 231076 .
Comment 4 Hans Petter Selasky freebsd_committer freebsd_triage 2018-09-12 13:32:00 UTC

*** This bug has been marked as a duplicate of bug 231076 ***