windows: Update isochronous OUT packet actual length

On Windows, unlike other platforms, the isochronous packet actual_length
value is not set on completion of OUT transfers. However, our API
requires the user to check this value for isochronous transfers instead
of the transfer actual_length, if the transferred length is of interest.

The usbd Length field is not used for isochronous OUT transfers:
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/usb/ns-usb-_usbd_iso_packet_descriptor

To make it consistent with other platforms, just return the requested
length.

Fixes #1105
Closes #1107

Tested-by: Xiaofan Chen <xiaofanc@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
This commit is contained in:
Tormod Volden
2022-04-03 15:35:00 +02:00
parent bfa8b8535a
commit bfbef179b1
2 changed files with 11 additions and 2 deletions

View File

@@ -3245,7 +3245,13 @@ static enum libusb_transfer_status winusbx_copy_transfer_data(int sub_api, struc
// iso only supported on libusbk-based backends for now
PKISO_CONTEXT iso_context = transfer_priv->iso_context;
for (i = 0; i < transfer->num_iso_packets; i++) {
transfer->iso_packet_desc[i].actual_length = iso_context->IsoPackets[i].actual_length;
if (IS_XFERIN(transfer)) {
transfer->iso_packet_desc[i].actual_length = iso_context->IsoPackets[i].actual_length;
} else {
// On Windows the usbd Length field is not used for OUT transfers.
// Copy the requested value back for consistency with other platforms.
transfer->iso_packet_desc[i].actual_length = transfer->iso_packet_desc[i].length;
}
// TODO translate USDB_STATUS codes http://msdn.microsoft.com/en-us/library/ff539136(VS.85).aspx to libusb_transfer_status
//transfer->iso_packet_desc[i].status = transfer_priv->iso_context->IsoPackets[i].status;
}
@@ -3266,6 +3272,9 @@ static enum libusb_transfer_status winusbx_copy_transfer_data(int sub_api, struc
} else {
for (i = 0; i < transfer->num_iso_packets; i++) {
transfer->iso_packet_desc[i].status = LIBUSB_TRANSFER_COMPLETED;
// On Windows the usbd Length field is not used for OUT transfers.
// Copy the requested value back for consistency with other platforms.
transfer->iso_packet_desc[i].actual_length = transfer->iso_packet_desc[i].length;
}
}
} else {

View File

@@ -1 +1 @@
#define LIBUSB_NANO 11719
#define LIBUSB_NANO 11720