none
WinCE 6: USB Enumeration fails w/ Interface with zero endpoints (only control endpoint) RRS feed

  • Question

  • I have a device that is not enumerating properly on Windows CE 6.0.  It contains an interface that lists zero as the number of endpoints.  As far I know, this is a valid interface that uses only the control endpoint.  However, the enumeration fails when determining the number of interfaces.  Specifically, in BSP/common/src/soc/COMMON_FSL_V3/MS/USBH/USB2COM/cdevice.cpp, the CreateUsbConfigurationStructure() call fails in the "second step".  In my case, the buffer contains 18 bytes, which correspond to a configuration descriptor and an interface descriptor.  The interface descriptor specifies bNumEndpoints == 0, and there are also no additional interfaces.  Therefore, 18 is the complete length of the data for the two descriptors.  The code has a test:

                while (offset + x + sizeof(USB_INTERFACE_DESCRIPTOR) < dataBufferLen)

    where offset=9, x=0, and dataBufferLen=18 in my situation.  Therefore, the test fails, preventing the number of interfaces from being incremented, and resulting in a failure of the entire enumeration.

    Changing the '<' to '<=' seems to resolve the problem, but was wondering if anyone else has run into this issue, or could confirm that this is an appropriate resolution.

    The only information that I found was a similar issue with WinCE 5.0:

    http://goo.gl/kZ9Fxy

    I checked the code for both WinCE 6.0 & WinCE 7.0, and both use the same conditional statement, so presumably both will fail, although I've only tried WinCE 6.0.

    Thanks for your help.

    Chris

    Wednesday, January 29, 2014 8:55 PM

Answers

  • Hi Chris,

    We hit the opposite bug years ago on WinCE6, in    C:\WinCe600\PUBLIC\COMMON\OAK\DRIVERS\USB\HCD\USB20\USB2COM\cdevice.cpp

    The same while condition there has <= and we had to change to < to fix a similar problem enumerating USB flash drives.   We submitted a bug to Microsoft, pointed out the exact line to fix... and years of QFE's later it still is not fixed.   Maybe you'll have better luck submitting a bug to them, tho since they are working on CE9 I doubt they care much about CE6.  In general the USB enumeration code is extremely buggy on CE6, it's a little better on CE7. 

    We cloned the Microsoft PUBLIC code and fixed it ourselves.  You can google how to clone code - do NOT just change your copy of the PUBLIC or Platform code...

    Good luck.

    Sue Wolber

    • Marked as answer by cwyse Thursday, January 30, 2014 2:54 PM
    Thursday, January 30, 2014 1:51 AM
  • Of course these drivers are not covered all the cases, i too faced similar enumeration issues few years before during developing a custom USB HID function client driver. One of the advantage on Windows CE is, it is extremely customizable. i cloned the public driver and put it in my BSP and changed it for my use.

    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp


    • Edited by Vinoth[MCTS] Thursday, January 30, 2014 5:50 AM
    • Marked as answer by cwyse Thursday, January 30, 2014 2:54 PM
    Thursday, January 30, 2014 5:48 AM

All replies

  • I believe that this code is common across architectures, but if not, I was using a Freescale i.MX287 processor.
    Wednesday, January 29, 2014 9:36 PM
  • Hi Chris,

    We hit the opposite bug years ago on WinCE6, in    C:\WinCe600\PUBLIC\COMMON\OAK\DRIVERS\USB\HCD\USB20\USB2COM\cdevice.cpp

    The same while condition there has <= and we had to change to < to fix a similar problem enumerating USB flash drives.   We submitted a bug to Microsoft, pointed out the exact line to fix... and years of QFE's later it still is not fixed.   Maybe you'll have better luck submitting a bug to them, tho since they are working on CE9 I doubt they care much about CE6.  In general the USB enumeration code is extremely buggy on CE6, it's a little better on CE7. 

    We cloned the Microsoft PUBLIC code and fixed it ourselves.  You can google how to clone code - do NOT just change your copy of the PUBLIC or Platform code...

    Good luck.

    Sue Wolber

    • Marked as answer by cwyse Thursday, January 30, 2014 2:54 PM
    Thursday, January 30, 2014 1:51 AM
  • Of course these drivers are not covered all the cases, i too faced similar enumeration issues few years before during developing a custom USB HID function client driver. One of the advantage on Windows CE is, it is extremely customizable. i cloned the public driver and put it in my BSP and changed it for my use.

    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp


    • Edited by Vinoth[MCTS] Thursday, January 30, 2014 5:50 AM
    • Marked as answer by cwyse Thursday, January 30, 2014 2:54 PM
    Thursday, January 30, 2014 5:48 AM