diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2016-02-23 23:45:51 -0800 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2016-02-23 23:45:51 -0800 |
commit | 60e875dc90c48df5101fefc4ef7c76516bbcc6e4 (patch) | |
tree | 4e1ef7ff1216860e64fe69e129ba2cc09a63191e | |
parent | 8e3d41e5818c68eb9ea95e0066c44f29b3f5943a (diff) | |
download | libusb-60e875dc90c48df5101fefc4ef7c76516bbcc6e4.tar.gz |
sync: Allow transferred argument to be optional in bulk APIs
Closes #139
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r-- | libusb/sync.c | 12 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libusb/sync.c b/libusb/sync.c index 0d1acd8..668909c 100644 --- a/libusb/sync.c +++ b/libusb/sync.c @@ -188,7 +188,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle, sync_transfer_wait_for_completion(transfer); - *transferred = transfer->actual_length; + if (transferred) + *transferred = transfer->actual_length; + switch (transfer->status) { case LIBUSB_TRANSFER_COMPLETED: r = 0; @@ -245,7 +247,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle, * \param length for bulk writes, the number of bytes from data to be sent. for * bulk reads, the maximum number of bytes to receive into the data buffer. * \param transferred output location for the number of bytes actually - * transferred. + * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105), + * it is legal to pass a NULL pointer if you do not wish to receive this + * information. * \param timeout timeout (in millseconds) that this function should wait * before giving up due to no response being received. For an unlimited * timeout, use value 0. @@ -296,7 +300,9 @@ int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle, * \param length for bulk writes, the number of bytes from data to be sent. for * bulk reads, the maximum number of bytes to receive into the data buffer. * \param transferred output location for the number of bytes actually - * transferred. + * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105), + * it is legal to pass a NULL pointer if you do not wish to receive this + * information. * \param timeout timeout (in millseconds) that this function should wait * before giving up due to no response being received. For an unlimited * timeout, use value 0. diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 3b9aefc..9bb57fa 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11053 +#define LIBUSB_NANO 11054 |