BUG: Short or Aborted USB Transfers Causes Data Toggle Problems

ID: Q180576


The information in this article applies to:
  • Microsoft Windows OEM Service Release version 2.1


SYMPTOMS

Under the Universal Serial Bus (USB) Supplement for OSR 2 (OSR 2.1), it is possible that a short or aborted USB transfer for a bulk or interrupt endpoint may cause a subsequent transfer to either fail, or to discard the first data packet of the transfer. This problem is caused by a data toggle synchronization problem between the endpoint on the USB device and the driver (UHCD.SYS) for the UHCI (Universal Host Controller Interface) USB host controller.


CAUSE

This problem arises because the UHCI driver computes the data toggle for an endpoint based upon the number of transfer descriptors built for the transfer, rather than the number of transfer descriptors actually used. If a transfer turns out to be short or aborted, it is possible that the data toggle state maintained by the UHCI driver will not be synchronized with the data toggle state maintained by the USB device itself. Subsequent attempts to transfer data on the endpoint may fail due to the incorrect data toggle. It is also possible that a subsequent transfer request will succeed if the USBD_SHORT_TRANSFER_OK flag is set, but will discard the first data packet of the transfer due to the mismatched data toggle.

It should be noted that this problem only exists in the UHCI driver for OSR 2.1, and does not exist in the OHCI (Open Host Controller Interface) driver (OPENHCI.SYS).


RESOLUTION

On all short or aborted transfers, a Windows Driver Model (WDM) driver must reset the data toggle states maintained by both the UHCI driver and the USB device itself. To do so, the following sequence must be followed when the short or aborted transfer occurs:

  1. Reset the pipe using the URB_FUNCTION_RESET_PIPE function. On OSR 2.1 this will cause the UHCI driver to reset the data toggle state maintained by the driver to DATA0, and return a URB status of 0x40000005. On an OHCI controller this function will return a URB status of USBD_STATUS_SUCCESS, but it will not cause the data toggle to be reset to DATA0 on the host. On post OSR 2.1 implementations of WDM, this URB will return a status of STATUS_INVALID_PARAMETER because the size of the _URB_PIPE_REQUEST URB has changed in post OSR 2.1 implementations of WDM. If the URB_FUNCTION_RESET_PIPE request returns a URB status of anything other than 0x40000005, the WDM driver should simply resume normal operation because the data toggle problem does not exist outside of the OSR 2.1 version of the UHCI host controller driver.


  2. Assuming the URB_FUNCTION_RESET_PIPE URB returns a URB status of 0x40000005, the WDM driver should then issue a clear feature request for the pipe using the URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT function with a feature selector of ENDPOINT_STALL. Firmware on the USB device must reset the data toggle to DATA0 when it receives this clear feature request.



STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.


REFERENCES

Universal Serial Bus Specification, version 1.0

Additional query words: USB OSR 2.1 data toggle short transfer bulk WDM UHCI

Keywords :
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: October 12, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.