summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2016-02-24 01:50:40 -0800
committerChris Dickens <christopher.a.dickens@gmail.com>2016-02-24 01:50:40 -0800
commitb99391deb4894bbfff59fab985c99fc55a43169a (patch)
tree31626486406446cafc8cefe0599e7dfaf56f6d65
parent7ab9087659dd147b7e3e535b84da10d2f071aa9e (diff)
downloadlibusb-b99391deb4894bbfff59fab985c99fc55a43169a.tar.gz
Misc: Document the return code for control transfers that are too large
Closes #110 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r--libusb/io.c2
-rw-r--r--libusb/os/windows_winusb.c2
-rw-r--r--libusb/sync.c2
-rw-r--r--libusb/version_nano.h2
4 files changed, 7 insertions, 1 deletions
diff --git a/libusb/io.c b/libusb/io.c
index 74dba4b..2cd6a6e 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -1463,6 +1463,8 @@ static int remove_from_flying_list(struct usbi_transfer *transfer)
* \returns LIBUSB_ERROR_BUSY if the transfer has already been submitted.
* \returns LIBUSB_ERROR_NOT_SUPPORTED if the transfer flags are not supported
* by the operating system.
+ * \returns LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than
+ * the operating system and/or hardware can support
* \returns another LIBUSB_ERROR code on other failure
*/
int API_EXPORTED libusb_submit_transfer(struct libusb_transfer *transfer)
diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c
index fec6ebe..a3bc11d 100644
--- a/libusb/os/windows_winusb.c
+++ b/libusb/os/windows_winusb.c
@@ -2673,6 +2673,8 @@ static int winusbx_submit_control_transfer(int sub_api, struct usbi_transfer *it
transfer_priv->pollable_fd = INVALID_WINFD;
size = transfer->length - LIBUSB_CONTROL_SETUP_SIZE;
+ // Windows places upper limits on the control transfer size
+ // See: https://msdn.microsoft.com/en-us/library/windows/hardware/ff538112.aspx
if (size > MAX_CTRL_BUFFER_LENGTH)
return LIBUSB_ERROR_INVALID_PARAM;
diff --git a/libusb/sync.c b/libusb/sync.c
index c8514dd..a609f65 100644
--- a/libusb/sync.c
+++ b/libusb/sync.c
@@ -87,6 +87,8 @@ static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
* device
* \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns LIBUSB_ERROR_BUSY if called from event handling context
+ * \returns LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than
+ * the operating system and/or hardware can support
* \returns another LIBUSB_ERROR code on other failures
*/
int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 6375e49..9be763f 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11057
+#define LIBUSB_NANO 11058