Skip to main content

 none
Cancelled USB Bulk Out Transfer returns incorrect TransferBufferLength RRS feed

  • Question

  • When my Windows WDM driver cancels a 64-byte USB Bulk Out Transfer to a USB device the completion handler always shows URB.TransferBufferLength of zero even though I  can see from a USB analyzer that the transfer actually completed.  I would have expected the URB.TransferBufferLength to be 64.  This is happening on a 32-bit Windows 7 platform.

    Tim

    Friday, August 30, 2019 10:04 PM

Answers

  • When you receive a !NT_STATUS value there is no data returned. While it may have completed successfully on the wire, software processing of the request cancel does not propagate the data. This is expected.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 2, 2019 5:55 AM

All replies

  • What is the NTSTATUS returned in the irp/urb in the completion routine?

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, August 31, 2019 3:31 PM
  • IRP status is 0xc0000120, URB is 0xc0010000.  I believe both indicate a cancel.  Thanks for the quick reply!

    Tim

    Sunday, September 1, 2019 10:18 PM
  • When you receive a !NT_STATUS value there is no data returned. While it may have completed successfully on the wire, software processing of the request cancel does not propagate the data. This is expected.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 2, 2019 5:55 AM
  • Thanks again, Doron!  It surprises me that the actual number of bytes transferred would not be returned regardless of whether the IRP status is STATUS_SUCCESS or STATUS_CANCELLED.  My driver (for a USB to serial bridge) relies on the Windows USB stack to return an accurate TransferBufferLength in response to IoCancelIrp so that it in turn can return an accurate count in IoStatus.Information when it completes the application's IRP.  Do you know of a mechanism by which I could query the USB stack for the actual URB.TransferBufferLength once the callback receives the cancelled status?



    Tim

    Tuesday, September 3, 2019 12:17 AM