diff options
author | Toby Gray <toby.gray@realvnc.com> | 2013-02-13 15:21:52 +0000 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2013-02-14 00:11:10 +0000 |
commit | 5541bafa48b6075488313d8b57c2c7c9a2359ba4 (patch) | |
tree | 47b916c83f3ab122aa29c135d2791f1ea9440f64 | |
parent | 0a833bc41750bded7d7f182efd564ef8fff6b67f (diff) | |
download | libusb-5541bafa48b6075488313d8b57c2c7c9a2359ba4.tar.gz |
Windows: Update transferred data on timeout or cancel.
* When handling aborted transfer it's possible that some data (but not
the full buffer) was transferred.
* This change ensures that this partially transferred data is recorded
and passed up to the caller.
-rw-r--r-- | libusb/os/windows_usb.c | 8 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 8a8caf4..fff21f3 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -2030,9 +2030,9 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t { struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev); - int status; + int status, istatus; - usbi_dbg("handling I/O completion with errcode %d", io_result); + usbi_dbg("handling I/O completion with errcode %d, size %d", io_result, io_size); switch(io_result) { case NO_ERROR: @@ -2047,6 +2047,10 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t status = LIBUSB_TRANSFER_TIMED_OUT; break; case ERROR_OPERATION_ABORTED: + istatus = priv->apib->copy_transfer_data(SUB_API_NOTSET, itransfer, io_size); + if (istatus != LIBUSB_TRANSFER_COMPLETED) { + usbi_dbg("Failed to copy partial data in aborted operation: %d", istatus); + } if (itransfer->flags & USBI_TRANSFER_TIMED_OUT) { usbi_dbg("detected timeout"); status = LIBUSB_TRANSFER_TIMED_OUT; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index cd49855..c6aa34d 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10603 +#define LIBUSB_NANO 10604 |