diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2012-08-13 18:10:52 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2012-08-13 18:10:52 +0000 |
commit | 07b6ce3ba9cd582560d2a716f266cb76176c515e (patch) | |
tree | 1953abbbd5e16ff4c9b2baf72bc0aa54e4369b04 /lib/libusb/libusb20_ugen20.c | |
parent | e9cec01683b1f3f70a22f28bf4c0b275fc528f26 (diff) | |
download | src-07b6ce3ba9cd582560d2a716f266cb76176c515e.tar.gz src-07b6ce3ba9cd582560d2a716f266cb76176c515e.zip |
Add support for streams to LibUSB v2.0.
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=239239
Diffstat (limited to 'lib/libusb/libusb20_ugen20.c')
-rw-r--r-- | lib/libusb/libusb20_ugen20.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index 17c948b4ac38..2c677783d850 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -741,9 +741,13 @@ ugen20_process(struct libusb20_device *pdev) static int ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, - uint32_t MaxFrameCount, uint8_t ep_no, uint8_t pre_scale) + uint32_t MaxFrameCount, uint8_t ep_no, uint16_t stream_id, + uint8_t pre_scale) { - struct usb_fs_open temp; + union { + struct usb_fs_open fs_open; + struct usb_fs_open_stream fs_open_stream; + } temp; struct usb_fs_endpoint *fsep; if (pre_scale) @@ -754,20 +758,26 @@ ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, fsep = xfer->pdev->privBeData; fsep += xfer->trIndex; - temp.max_bufsize = MaxBufSize; - temp.max_frames = MaxFrameCount; - temp.ep_index = xfer->trIndex; - temp.ep_no = ep_no; + temp.fs_open.max_bufsize = MaxBufSize; + temp.fs_open.max_frames = MaxFrameCount; + temp.fs_open.ep_index = xfer->trIndex; + temp.fs_open.ep_no = ep_no; - if (ioctl(xfer->pdev->file, USB_FS_OPEN, &temp)) { - return (LIBUSB20_ERROR_INVALID_PARAM); + if (stream_id != 0) { + temp.fs_open_stream.stream_id = stream_id; + + if (ioctl(xfer->pdev->file, USB_FS_OPEN_STREAM, &temp.fs_open_stream)) + return (LIBUSB20_ERROR_INVALID_PARAM); + } else { + if (ioctl(xfer->pdev->file, USB_FS_OPEN, &temp.fs_open)) + return (LIBUSB20_ERROR_INVALID_PARAM); } /* maximums might have changed - update */ - xfer->maxFrames = temp.max_frames; + xfer->maxFrames = temp.fs_open.max_frames; /* "max_bufsize" should be multiple of "max_packet_length" */ - xfer->maxTotalLength = temp.max_bufsize; - xfer->maxPacketLen = temp.max_packet_length; + xfer->maxTotalLength = temp.fs_open.max_bufsize; + xfer->maxPacketLen = temp.fs_open.max_packet_length; /* setup buffer and length lists using zero copy */ fsep->ppBuffer = libusb20_pass_ptr(xfer->ppBuffer); |