libusb批量传输的最大长度

时间:2017-08-23 11:07:57

标签: linux libusb

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

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

1 个答案:

答案 0 :(得分:1)

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

实际上,我认为确切的数字取决于设备和/或应用程序。我看到过声称存在较大数据包大小问题的讨论(例如: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;
};