You experience various problems after you unplug a USB device that is using a bulk transfer in Windows CE 5.0 (904643)



The information in this article applies to:

  • Microsoft Windows CE 5.0

SYMPTOMS

Consider the following scenario. On a computer that is running Microsoft Windows CE 5.0, when you unplug a universal serial bus (USB) device that is using a bulk transfer, the memory that was allocated for the bulk transfer is not correctly freed. After you have unplugged and replugged the USB device several times in succession, the Enhance Host Controller Interface (EHCI) driver may be unable to allocate sufficient memory to enable the attachment of an additional USB device. When this occurs, the Windows CE 5.0-based computer may not recognize any subsequent USB device that you try to attach.

CAUSE

This problem is caused by a coding error in the EHCI driver that prevents the EHCI driver from correctly deallocating memory.

RESOLUTION

Software update information

A supported software update is now available from Microsoft as Windows CE 5.0 Core OS QFE 904643. To resolve this problem immediately, click the following article number for information about obtaining Windows CE Platform Builder and core operating system software updates:

837392 How to locate core operating system fixes for Microsoft Windows CE Platform Builder products

Prerequisites

This software update is supported only if all previously issued software updates for this product have also been installed.

Restart requirement

After you install this software update, you must perform a clean build of the whole platform. To clean the platform, click Clean on the Build menu. To build the platform, click Build Platform on the Build menu. You do not have to restart your computer after you apply this software update.

Software update replacement information

This software update does not replace any other software updates.

File information

The English version of this package has the file attributes (or later file attributes) that are listed in the following table.
   Date         Time   Version         Size       File name
   --------------------------------------------------------------------------------------
   12-Sep-2005  22:13                  1,379,840  Wincepb50-050912-kb904643-armv4i.msi
   12-Sep-2005  22:13                  1,416,704  Wincepb50-050912-kb904643-mipsii.msi
   12-Sep-2005  22:13                  1,417,216  Wincepb50-050912-kb904643-mipsii_fp.msi
   12-Sep-2005  22:13                  1,430,016  Wincepb50-050912-kb904643-mipsiv.msi
   12-Sep-2005  22:13                  1,430,528  Wincepb50-050912-kb904643-mipsiv_fp.msi
   12-Sep-2005  22:13                  1,342,976  Wincepb50-050912-kb904643-sh4.msi
   12-Sep-2005  22:13                  1,214,976  Wincepb50-050912-kb904643-x86.msi
The English version of this software update has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version         Size       File name
   -----------------------------------------------------------

   Path: Public\Common\Oak\Drivers\Usb\Hcd\Usb20\Ehci
   26-Jul-2005  22:45                     76,491  Cpipe.cpp

   Path: Public\Common\Oak\Lib\Armv4i\Debug
   26-Jul-2005  22:44                    698,604  Ehcdmdd.lib
   30-Aug-2005  23:47                  1,265,710  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Armv4i\Retail
   26-Jul-2005  22:44                    428,362  Ehcdmdd.lib
   30-Aug-2005  23:47                    682,512  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsii\Debug
   26-Jul-2005  22:44                    712,732  Ehcdmdd.lib
   30-Aug-2005  23:47                  1,300,248  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsii\Retail
   26-Jul-2005  22:44                    410,832  Ehcdmdd.lib
   30-Aug-2005  23:47                    668,792  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsii_fp\Debug
   26-Jul-2005  22:44                    712,788  Ehcdmdd.lib
   30-Aug-2005  23:47                  1,300,364  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsii_fp\Retail
   26-Jul-2005  22:44                    410,898  Ehcdmdd.lib
   30-Aug-2005  23:47                    668,916  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsiv\Debug
   26-Jul-2005  22:45                    719,310  Ehcdmdd.lib
   30-Aug-2005  23:47                  1,312,110  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsiv\Retail
   26-Jul-2005  22:44                    411,740  Ehcdmdd.lib
   30-Aug-2005  23:47                    671,114  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsiv_fp\Debug
   26-Jul-2005  22:45                    719,366  Ehcdmdd.lib
   30-Aug-2005  23:47                  1,312,226  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Mipsiv_fp\Retail
   26-Jul-2005  22:45                    411,802  Ehcdmdd.lib
   30-Aug-2005  23:47                    671,230  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Sh4\Debug
   26-Jul-2005  22:44                    627,710  Ehcdmdd.lib
   30-Aug-2005  23:46                  1,132,622  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\Sh4\Retail
   26-Jul-2005  22:43                    376,966  Ehcdmdd.lib
   30-Aug-2005  23:46                    612,508  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\X86\Debug
   26-Jul-2005  22:43                    561,102  Ehcdmdd.lib
   30-Aug-2005  23:46                  1,042,216  Ehci_lib.lib

   Path: Public\Common\Oak\Lib\X86\Retail
   26-Jul-2005  22:43                    364,492  Ehcdmdd.lib
   30-Aug-2005  23:46                    590,142  Ehci_lib.lib

WORKAROUND

To work around this problem, follow these steps to modify the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Usb20\Ehci\Cpipe.cpp file.
  1. Locate and then open the %WINCEROOT%\Public\Common\Oak\Drivers\Usb\Hcd\Usb20\Ehci\Cpipe.cpp file for editing.
  2. Locate the following lines of code:
        if (m_pQueuedTransfer) {
            RemoveQHeadFromQueue();
            m_pQueuedTransfer;
            m_pQueuedTransfer ->AbortTransfer();
            GetQHead()->InvalidNextTD();  
            m_pCEhcd->AsyncBell();
            Sleep(2);// this sleep is for Interrupt Pipe;
            m_pQueuedTransfer->DoneTransfer();
            m_pQueuedTransfer =  NULL;
            delete m_pQueuedTransfer;
            m_pQueuedTransfer = NULL;
            InsertQHeadToQueue() ;
        }
  3. Modify the code so that it looks similar to the following:
        if (m_pQueuedTransfer) {
            RemoveQHeadFromQueue();
            m_pQueuedTransfer ->AbortTransfer();
            GetQHead()->InvalidNextTD();  
            m_pCEhcd->AsyncBell();
            Sleep(2);// this sleep is for Interrupt Pipe;
            m_pQueuedTransfer->DoneTransfer();
            delete m_pQueuedTransfer;
            m_pQueuedTransfer = NULL;
            InsertQHeadToQueue() ;
        }
  4. Save the changes.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

When this problem occurs, the kernel debugger will contain the following message:
CPhysMem AllocateMemory : No memory available
 CPipe(Bulk)::IssueTransfer - no memory for TD buffer

Modification Type:MinorLast Reviewed:7/25/2006
Keywords:kbBug kbfix kbQFE kbpubtypekc KB904643