libusb: implement libusb_fill_bulk_stream_transfer

Bulk streams are essentially bulk transfers with a stream ID. All
requirements from both libusb20 and the kernel are already handled; we
just need to set the stream ID.

Approved by:    markj (mentor), lwhsu(mentor)
Differential Revision: https://reviews.freebsd.org/D51226
This commit is contained in:
ShengYi Hung
2025-07-09 07:27:26 -04:00
parent 776e26f568
commit 3eda349340
3 changed files with 15 additions and 0 deletions
+1
View File
@@ -122,6 +122,7 @@ enum libusb_transfer_type {
LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1,
LIBUSB_TRANSFER_TYPE_BULK = 2,
LIBUSB_TRANSFER_TYPE_INTERRUPT = 3,
LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4,
};
enum libusb_standard_request {
+1
View File
@@ -1530,6 +1530,7 @@ libusb10_submit_transfer_sub(struct libusb20_device *pdev, uint8_t endpoint)
libusb20_tr_set_callback(pxfer0, libusb10_isoc_proxy);
break;
case LIBUSB_TRANSFER_TYPE_BULK:
case LIBUSB_TRANSFER_TYPE_BULK_STREAM:
case LIBUSB_TRANSFER_TYPE_INTERRUPT:
libusb20_tr_set_callback(pxfer0, libusb10_bulk_intr_proxy);
break;
+13
View File
@@ -780,6 +780,19 @@ libusb_fill_interrupt_transfer(struct libusb_transfer *transfer,
transfer->callback = callback;
}
void
libusb_fill_bulk_stream_transfer(struct libusb_transfer *transfer,
libusb_device_handle *dev_handle, unsigned char endpoint,
uint32_t stream_id, unsigned char *buffer, int length,
libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout)
{
libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer,
length, callback, user_data, timeout);
transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM;
libusb_transfer_set_stream_id(transfer, stream_id);
}
void
libusb_fill_iso_transfer(struct libusb_transfer *transfer,
libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf,