[Bug 293812] libusb is capping asynchronous CONTROL transfers to 1024 bytes

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 14 Mar 2026 19:08:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293812

            Bug ID: 293812
           Summary: libusb is capping asynchronous CONTROL transfers to
                    1024 bytes
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: usb@FreeBSD.org
          Reporter: vladislav.movchan@gmail.com

Created attachment 268808
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268808&action=edit
Increase limit for asynchronous CONTROL transfers

There is a 1024 bytes limit for size of asynchronous CONTROL transfers.
The limit comes from libusb10_get_buffsize(), and it is applied to asynchronous
transfers only.

This limit is too short limit to read configuration descriptor (usual
operation) for quite common Logitech Webcam:

# usbconfig -d ugen0.6 dump_curr_config_desc | head -15
ugen0.6: <C922 Pro Stream Webcam Logitech, Inc.> at usbus0, cfg=0 md=HOST
spd=HIGH (480Mbps) pwr=ON (500mA)

 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x09c7    <=== buffer size required to read whole
configuration descriptor (2503 bytes)
    bNumInterfaces = 0x0004
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x00fa
===

After attempt to read configuration descriptor asynchronously libusb_transfer
looks like this:
libusb_transfer {
    dev_handle: 0x0000451f93a223c0,
    flags: 0,
    endpoint: 0,
    type_: 0,
    timeout: 0,
    status: LIBUSB_TRANSFER_STALL,   <=== request has not been successful (i.e.
not LIBUSB_TRANSFER_COMPLETED)
    length: 2511,                    <=== allocated buffer: 2503 + 8 bytes for
Setup
    actual_length: 1032,             <=== read data: 1024 + 8 bytes for Setup
    callback: Some(
        0x00002f0b2adb6870,
    ),
    user_data: 0x0000451f8d802070,
    buffer: 0x0000451f8d835000,
    num_iso_packets: 0,
    iso_packet_desc: __IncompleteArrayField,
}

There are no means to read remaining data (bytes 1024 to 2503).

After bumping the limit from 1024 to 4096 in libusb10_get_buffsize() the
problem is gone.

4096 value seem to correspond to Linux libusb implementation (see
https://github.com/search?q=repo%3Alibusb%2Flibusb%20MAX_CTRL_BUFFER_LENGTH&type=code)
Windows seem to allow at least 4k CONTROL transfers - see
https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-bandwidth-allocation#maximum-transfer-size

-- 
You are receiving this mail because:
You are the assignee for the bug.