Page MenuHomeFreeBSD

libusb: don't treat EINVAL from USB_FS_COMPLETE as device detach
ClosedPublic

Authored by aokblast on Jun 11 2026, 3:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 17, 12:00 PM
Unknown Object (File)
Wed, Jul 15, 7:25 AM
Unknown Object (File)
Wed, Jul 15, 7:25 AM
Unknown Object (File)
Mon, Jul 13, 10:57 PM
Unknown Object (File)
Sat, Jul 11, 4:44 PM
Unknown Object (File)
Sat, Jul 11, 12:10 AM
Unknown Object (File)
Wed, Jul 8, 5:47 AM
Unknown Object (File)
Mon, Jul 6, 11:50 AM
Subscribers

Details

Summary

ugen20_process() treats any non-EBUSY errno returned by USB_FS_COMPLETE
as device detach and returns LIBUSB20_ERROR_OTHER. This causes libusb10
to set device_is_gone and fail all subsequent transfer with
LIBUSB_ERROR_NO_DEVICE.

However, USB_FS_COMPLETE can also return EINVAL when a completion
references an endpoint that no longer exists, for example after
SET_INTERFACE or SET_CONFIG removes and recreates endpoints. This is a
transient condition and does not indicate device detach.

Treat EINVAL the same as EBUSY and stop draining completions. This
prevents a guest selecting an isochronous streaming altsetting from
permanently breaking the passed-through device.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable