WinUSB Ctrl Transfer 4K limitation

Michael 1 Reputation point
2021-09-01T00:42:25.75+00:00

Is there any particular reason why winusb limits control transfers to 4k?

It would be a big help if WinUSB could be fixed to support 64K transfers to follow the usb spec because some devices need more than 4k transfers.

Could this request be put in to someone at microsoft to fix WinUSB in the next service pack or something?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,944 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,566 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 39,461 Reputation points
    2021-09-01T10:34:05.083+00:00

    Hello,

    Thank you for your question and reaching out.

    First you should read out MAXIMUM_TRANSFER_SIZE. For sending, WinUSB "divides the buffer into appropriately sized chunks, if necessary" (source).

    Also check the remarks of WinUsb_ReadPipe:

    If the data returned by the device is greater than a maximum transfer length, WinUSB divides the request into smaller requests of maximum transfer length and submits them serially. If the transfer length is not a multiple of the endpoint's maximum packet size (retrievable through the WINUSB_PIPE_INFORMATION structure's MaximumPacketSize member), WinUSB increases the size of the transfer to the next multiple of MaximumPacketSize.

    USB packet size does not factor into the transfer for a read request. If the device responds with a packet that is too large for the client buffer, the behavior of the read request corresponds to the type of policy set on the pipe. If policy type for the pipe is ALLOW_PARTIAL_READS, WinUSB adds the remaining data to the beginning of the next transfer. If ALLOW_PARTIAL_READS is not set, the read request fails. For more information about policy types, see WinUSB Functions for Pipe Policy Modification.

    Check your settings and whether the last Byte is send with a second transfer. You also should test how many bytes have been actually written / read.

    Please have a look on below Microsoft threads.

    https://social.msdn.microsoft.com/Forums/Windows/en-US/4509724d-0ca6-40a7-ae75-cb2add310df0/is-there-a-maximum-size-for-bufferlength-in-winusbcontroltransfer?forum=wdk

    https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-functions-for-pipe-policy-modification

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    0 comments No comments

  2. Michael 1 Reputation point
    2021-09-02T05:18:47.297+00:00

    That is incorrect, you are talking about normal usb pipes.

    The control pipe is special and the Read/Write Pipe cannot be used to communicate with a USB Control endpoint. It is bi-directional, furthermore the set pipe policy flags don't have anything related to control endpoints.

    0 comments No comments