aboutsummaryrefslogtreecommitdiffstats
path: root/libusb/libusb.h
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2012-02-22 14:21:54 +0100
committerPeter Stuge <peter@stuge.se>2012-02-22 14:21:54 +0100
commite3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f (patch)
tree9e35f48029780e2d8b84bf12ba3e69a785d56286 /libusb/libusb.h
parent7e0c747cc5ed0a31f38dff5eb5f03d4043b05ada (diff)
downloadandroid_external_libusbx-e3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f.tar.gz
android_external_libusbx-e3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f.tar.bz2
android_external_libusbx-e3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f.zip
Add LIBUSB_TRANSFER_ADD_ZERO_PACKET flag to indicate need for ZLP
Some protocols which use USB require an extra zero length data packet to signal end-of-transfer on bulk endpoints, if the last data packet is exactly wMaxPacketSize bytes long. This flag allows applications to inform libusb about this requirement, so that libusb can handle the issue transparently. At the moment the new flag is only supported on Linux, and submitting a transfer with the flag set returns an error at submit time on other systems. Hopefully implementations will soon follow for other systems. References #6.
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r--libusb/libusb.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index 15e8698..4141a8e 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -799,6 +799,31 @@ enum libusb_transfer_flags {
* from your transfer callback, as this will result in a double-free
* when this flag is acted upon. */
LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2,
+
+ /** Terminate transfers that are a multiple of the endpoint's
+ * wMaxPacketSize with an extra zero length packet. This is useful
+ * when a device protocol mandates that each logical request is
+ * terminated by an incomplete packet (i.e. the logical requests are
+ * not separated by other means).
+ *
+ * This flag only affects host-to-device transfers to bulk and interrupt
+ * endpoints. In other situations, it is ignored.
+ *
+ * This flag only affects transfers with a length that is a multiple of
+ * the endpoint's wMaxPacketSize. On transfers of other lengths, this
+ * flag has no effect. Therefore, if you are working with a device that
+ * needs a ZLP whenever the end of the logical request falls on a packet
+ * boundary, then it is sensible to set this flag on <em>every</em>
+ * transfer (you do not have to worry about only setting it on transfers
+ * that end on the boundary).
+ *
+ * This flag is currently only supported on Linux.
+ * On other systems, libusb_submit_transfer() will return
+ * LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this flag is set.
+ *
+ * Available since libusb-1.0.9.
+ */
+ LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1 << 3,
};
/** \ingroup asyncio