libusb 批量传输的最大长度

Maximum length of libusb bulk transfer

在 Linux 中使用 libusb 时是否有批量传输的最大长度?

例如,你可以传递任何正值作为函数的长度参数吗libusb_fill_bulk_transfer?

理论上它是目标系统上int的最大正值。长度参数最终用于初始化传输结构的长度成员(参见libusb.h,下面粘贴的相对和缩写代码)。

实际上,我想确切的数字取决于设备 and/or 特定于应用程序。我看到过声称存在较大数据包大小问题的讨论(例如:LibUSB driver issues: timeout)。

libusb_fill_bulk_transfer:

static inline void libusb_fill_bulk_transfer(
    struct libusb_transfer *transfer,
    libusb_device_handle *dev_handle, 
    unsigned char endpoint,
    unsigned char *buffer, 
    int length, libusb_transfer_cb_fn callback,
    void *user_data, 
    unsigned int timeout)
{
            /* NOTE: Only relevant code is pasted here.  For complete code see official libusb.h file included with your distribution.  */
    transfer->length = length;
}

libusb_transfer:

struct libusb_transfer 
{
    /* NOTE: Only relevant code is pasted here.  For complete code see official libusb.h file included with your distribution.  */

    /** Length of the data buffer */
    int length;
};