This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TivaWare USBLib: USB host application will not recognize USB HID devices that do not give report descriptors

I am working on a Tiva C device using the TivaWare USB library to host USB HID devices. Unfortunately, one device that I am trying to host is designed not to give a report descriptor, and the USB host will not recognize this device. Is there a way to host devices that do not give a report descriptor?

  • Hello John,

    I don't think that is how the USBlib was structured. It should be able to enumerate the device to understand the correct class of device.

    Regards
    Amit
  • Thanks for your response Amit.

    Ok, I am still a bit confused then. I am working off of modified code from the USB Host Mouse example for the TivaC DK-123G board. I have modified the device class to look for a "vendor specific" device, yet when I connect my device, it sends a USB_EVENT_UNKNOWN_CONNECTED flag to the USB Host Event callback function. I looked through the code to find the issue, and I found the following code in "{TivaWare Root}/usblib/host/hostenum.c" in the enumeration state-machine at about line 5000:

                    if(USBHCDGetDeviceDescriptor(0,
                            &g_sUSBHCD.psUSBDevice[ui32DevIndex]) == 0)
                    {
                        //
                        // If the device descriptor cannot be read then the device
                        // will be treated as unknown.
                        //
                        g_sUSBHCD.piDeviceState[ui32DevIndex] = eHCDDevError;
    
                        DEBUG_OUTPUT("Connection %d - failed to get descriptor\n",
                                     ui32DevIndex);
    
                        //
                        // Send an unknown connection event to let the application
                        // know that there is a device connected but return no
                        // zero for the instance.
                        //
                        SendUnknownConnect(0, 0);
    
                        //
                        // If the device is connected via a hub, tell the hub
                        // driver that we experienced an error enumerating the
                        // device.
                        //
                        if(g_sUSBHCD.psUSBDevice[ui32DevIndex].ui8Hub)
                        {
                            USBHHubEnumerationError(
                                g_sUSBHCD.psUSBDevice[ui32DevIndex].ui8Hub,
                                g_sUSBHCD.psUSBDevice[ui32DevIndex].ui8HubPort);
                        }
                    }

    This section of code appears to reject devices that do not have descriptors. Is this correct? Is there any way to work around this?


    Thanks for your help!

  • Hello John,

    I am not sure what device the USB Host is being connected to. The USB Host is enumerating the Device and sends a Connect Request packet, for which it expects a response. if the size of the response packet is 0, which means that the device is not responding to the Connect request, then the USB Library will declare that no device is connected.

    Regards
    Amit
  • It is connecting to the device though. When I run the application, it connects to the device but declares it as an unknown device with the USB_EVENT_UNKNOWN_CONNECTED flag.

    The device I am trying to connect to is a Microsoft Xbox 360 controller. The controllers are fully HID compliant except that as a security measure, Microsoft designed the controllers not to respond to a descriptor request (the HID subclass value is also set to 0xFF instead of 0x03 for 'vendor_specific', but this is easily worked around).

    The code above states that any device that doesnt respond to a descriptor request should be rejected as an unknown device, but there must be a way to work around this. I know I can edit the USBlib source code and comment out the "sendUnknownConnect()" lines in the code above, but this will affect all other USB host projects using this library. Do you know of any way to work around this without changing the USB library and affecting all other projects?

    Thanks again for your help Amit,
    John
  • Hello John,

    You can place a define in the required file(s) like USB_ALLOW_UNKNOWN device and create a precompiled image called usblib_unknowndev.lib with this define. Use this new precompiled image. The other examples will still work with the original usblib.lib

    Regards
    Amit
  • Thanks for the suggestion! I expect this would work. I will give this a shot tomorrow and come back to confirm the answer if it works.
    Thank you!