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)
Mon, Aug 24, 1:47 AM
Unknown Object (File)
Fri, Aug 21, 9:05 AM
Unknown Object (File)
Thu, Aug 20, 10:29 AM
Unknown Object (File)
Wed, Aug 12, 11:21 PM
Unknown Object (File)
Wed, Aug 12, 7:24 PM
Unknown Object (File)
Tue, Aug 11, 5:33 PM
Unknown Object (File)
Mon, Aug 10, 10:53 AM
Unknown Object (File)
Mon, Aug 10, 9:39 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