Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133255392
D51759.id160029.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D51759.id160029.diff
View Options
diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h
--- a/lib/libusb/libusb.h
+++ b/lib/libusb/libusb.h
@@ -250,6 +250,7 @@
LIBUSB_TRANSFER_SHORT_NOT_OK = 1 << 0,
LIBUSB_TRANSFER_FREE_BUFFER = 1 << 1,
LIBUSB_TRANSFER_FREE_TRANSFER = 1 << 2,
+ LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1 << 3,
};
enum libusb_log_level {
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -1326,6 +1326,17 @@
}
/* check for end of data */
if (sxfer->rem_len == 0) {
+ if (flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) {
+ uxfer->flags &=
+ ~LIBUSB_TRANSFER_ADD_ZERO_PACKET;
+ libusb20_tr_setup_bulk(pxfer, sxfer->curr_data,
+ 0, uxfer->timeout);
+ libusb20_tr_submit(pxfer);
+ libusb10_submit_transfer_sub(
+ libusb20_tr_get_priv_sc0(pxfer),
+ uxfer->endpoint);
+ break;
+ }
libusb10_complete_transfer(pxfer, sxfer, LIBUSB_TRANSFER_COMPLETED);
break;
}
@@ -1347,7 +1358,8 @@
libusb20_tr_submit(pxfer);
/* check if we can fork another USB transfer */
- if (sxfer->rem_len == 0)
+ if (sxfer->rem_len == 0 &&
+ !(flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET))
libusb10_submit_transfer_sub(libusb20_tr_get_priv_sc0(pxfer), uxfer->endpoint);
break;
@@ -1575,7 +1587,7 @@
struct libusb_super_transfer *sxfer;
struct libusb_device *dev;
uint8_t endpoint;
- int err;
+ int err, mps;
if (uxfer == NULL)
return (LIBUSB_ERROR_INVALID_PARAM);
@@ -1596,6 +1608,11 @@
pxfer0 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 0);
pxfer1 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 1);
+ mps = libusb_get_max_packet_size(dev, endpoint);
+
+ if ((uxfer->flags & LIBUSB_TRANSFER_ADD_ZERO_PACKET) &&
+ ((endpoint & LIBUSB_ENDPOINT_IN) || uxfer->length % mps != 0))
+ uxfer->flags &= ~LIBUSB_TRANSFER_ADD_ZERO_PACKET;
if (pxfer0 == NULL || pxfer1 == NULL) {
err = LIBUSB_ERROR_OTHER;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 25, 9:22 AM (1 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24168684
Default Alt Text
D51759.id160029.diff (1 KB)
Attached To
Mode
D51759: libusb: implement zlp flag in libusb transfer
Attached
Detach File
Event Timeline
Log In to Comment