Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

XferData Fails when Large Amount of Data is Requested - KBA215067

XferData Fails when Large Amount of Data is Requested - KBA215067

Anonymous
Not applicable

Version: *A

Translation - Japanese: 大量のデータが要求されるとXferDataが失敗する - KBA215067 - Community Translated (JA)

Question:

When I use the XferData (or the BeginDataXfer) call, large amount of data is requested and the transfer can fail. Why does this happen and how do I fix it?

Answer:

XferData directly requests or sends the specified amount of data to the host controller driver. The host driver can queue only a certain maximum size depending on the transfer type (Bulk, Isoc, Interrupt, or Control) and the OS version. For details on the maximum transfer sizes, see the MSDN article at https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-bandwidth-allocation.

To overcome this issue, you can split the large request into multiple requests of smaller sizes (with the size equal to the maximum transfer size allowed in the specified OS).

Alternatively, you can use the third parameter of XferData called packetMode (Boolean) to queue requests in multiples of wMaxPacketSize.

So, for example, for bulk endpoints in C#, this would be:

bool isPacketMode = true;

bool transferResult = BulkEndpoint.XferData(ref xferBuffer, ref xferLength, isPacketMode);

0 Likes
526 Views
Contributors