WinUsb_SetPipePolicy and asynchronous IO RRS feed

  • Question

  • If I do something like:

    WinUsb_SetPipePolicy(..., SHORT_PACKET_TERMINATE, ...); /* Enable ZLP */
    WinUsb_WritePipe(..., 512, ..., &overlapped); /* Do overlapped write of 512 bytes */
    WinUsb_SetPipePolicy(..., SHORT_PACKET_TERMINATE, ...); /* Disable ZLP */

    Is there a race condition where the policy could be disabled before the async IO is actually performed? Or does the policy apply as long as it's set during the write call? Will I always get a zero length packet?

    • Edited by patstew Tuesday, May 29, 2018 1:09 PM
    Tuesday, May 29, 2018 1:09 PM


All replies

  • Yes, the short packet terminate policy may not be effective when the asynchronous write request completes. 
    Wednesday, May 30, 2018 1:42 AM
  • It is uncommon to change the short-packet policy on the fly.  For a given device, you either need it always, or you need it never.  Why do you need this?

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Wednesday, May 30, 2018 6:53 AM
  • I was trying to push a patch upstream to libusb, which doesn't support ZLPs on windows, a while ago ( which they won't accept because of the above issue. I just wanted to check that it really is an issue. For myself it works fine because I always have it on as you suggest.
    Wednesday, May 30, 2018 1:25 PM