HomeFreeBSD

libusb: implement libusb_wrap_sys_device

Description

libusb: implement libusb_wrap_sys_device

The libusb_wrap_sys_device function can wrap an opened fd from the
system into a libusb handler. However, in FreeBSD's libusb implementation, a
USB device contains two fds: one for control transfers and another for
normal (bulk, interrupt, isochronous) transfers.

This design makes it impossible for FreeBSD to implement this function
without exposing a different structure in libusb.h to provide two fds.
Therefore, we return LIBUSB_ERROR_NOT_SUPPORTED to maintain API
compatibility.

Approved by: makrj (mentor), lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51739

Details

Provenance
aokblastAuthored on Aug 5 2025, 12:59 PM
Differential Revision
D51739: libusb: implement libusb_wrap_sys_device
Parents
rGb0d5c1cfda76: libusb: implement libusb_pollfds_handle_timeouts
Branches
Unknown
Tags
Unknown

Event Timeline

Suggest a libusb20 method that retrieves the alternate fd when needed so that this compatible wrap function can be implemented. For comparison, we have libusb20_get_dev_fd with returns only one fd.