Misc: Document the return code for control transfers that are too large
authorChris Dickens <christopher.a.dickens@gmail.com>
Wed, 24 Feb 2016 09:50:40 +0000 (01:50 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Wed, 24 Feb 2016 09:50:40 +0000 (01:50 -0800)
Closes #110

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/io.c
libusb/os/windows_winusb.c
libusb/sync.c
libusb/version_nano.h

index 74dba4b..2cd6a6e 100644 (file)
@@ -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)
index fec6ebe..a3bc11d 100644 (file)
@@ -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;
 
index c8514dd..a609f65 100644 (file)
@@ -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,
index 6375e49..9be763f 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11057
+#define LIBUSB_NANO 11058