fix BUG-271

This commit is contained in:
gb 2022-08-13 16:41:09 +08:00
parent bc273e1aa0
commit 8c722521ee
1 changed files with 7 additions and 1 deletions

View File

@ -834,7 +834,13 @@ int usb_device::transfer_bulk(unsigned endpoint, unsigned char* data, int* lengt
{ {
GetOverlappedResult(h, oc->over_lapped(), oc->io_bytes(), FALSE); GetOverlappedResult(h, oc->over_lapped(), oc->io_bytes(), FALSE);
*length = *oc->io_bytes(); *length = *oc->io_bytes();
ret = LIBUSB_SUCCESS; if (*length == 0 && oc->over_lapped()->Internal != ERROR_SUCCESS)
{
ret = LIBUSB_ERROR_IO;
VLOG_MINI_2(LOG_LEVEL_WARNING, "Bulk-Transfer of endpoint 0x%02x failed with code 0x%08X\n", endpoint, oc->over_lapped()->Internal);
}
else
ret = LIBUSB_SUCCESS;
} }
else else
ret = LIBUSB_ERROR_TIMEOUT; ret = LIBUSB_ERROR_TIMEOUT;