• AVR Freaks

receive report without hid report descriptor?

Page: 12 > Showing page 1 of 2
Author
cutemonster
Junior Member
  • Total Posts : 93
  • Reward points : 0
  • Joined: 2009/03/22 22:01:17
  • Location: 0
  • Status: offline
2010/09/16 14:25:46 (permalink)
0

receive report without hid report descriptor?

I'm trying to receive button inputs from usb wired xbox 360 controller and found out there's no hid report descriptor.
I changed the class and interface according to data read from PC.
I wonder if there's any way to directly receive the report from the controller without going thru hid_parser.

So far, the usb host(pic24f) can read descriptors, set configuration... etc.
However, it says the report is ready but I can't output anything.  Don't know what I did wrong.

So, I hope somebody can tell me what is possible in this case.

Thanks!
more info http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo
Vendor: 0x045e (Microsoft) Product: 0x028e (UK version?) Version: 0x0110  Class 255, subclass 255, protocol 255  Interface 0: class 255, subclass 93, protocol 1 2 interrupt endpoints: in, out  Interface 1: class 255, subclass 93, protocol 3 4 interrupt endpoints: in, out, in, out  Interface 2: class 255, subclass 93, protocol 2 1 interrupt endpoint: in  Interface 3: class 255, subclass 253, protocol 19 0 endpoints


#1

20 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:receive report without hid report descriptor? 2010/09/16 16:44:11 (permalink)
    0

    I'm trying to receive button inputs from usb wired xbox 360 controller and found out there's no hid report descriptor.

    Start with "USB Host - MCHPUSB - Generic Driver Demo" example, instead of Host HID example.
    Then, you don't need to worry about the HID parser any more wink

    But I think the problem lies in the hub integrated into the controller (compound device).

    This web page tells that the original Xbox Controller is a compound device (ie. with hub)

    Inside Xbox Controller
    http://euc.jp/periphs/xbox-controller.ja.html

    Does Xbox 360 controller also have a hub?
    If so, you have to enumerate the hub, first.

    Tsuneo
    #2
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:receive report without hid report descriptor? 2010/09/16 17:47:28 (permalink)
    0

    Ah, I see.
    I found the lsusb readout on this web page.
    http://free60.org/GamePad

    It's a composite device, instead of a compound device.
    It's reasonable. Hardware cost is less than the original.

    Tsuneo
    #3
    cutemonster
    Junior Member
    • Total Posts : 93
    • Reward points : 0
    • Joined: 2009/03/22 22:01:17
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2010/09/16 18:44:11 (permalink)
    0
    Hi Tsuneo.  
      Thanks for the links.


      How can I focus on interface 0 only? since this is where report comes in.
      Is it possible to hardcode interface and endpoint data into usbhost read/write?


    Thanks!
    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:receive report without hid report descriptor? 2010/09/17 05:37:53 (permalink)
    0
    Is it possible to hardcode interface and endpoint data into usbhost read/write?

    Yes, for personal project.
    Quick and easy is the motto of personal projects wink

    But for production, find the address of target endpoints with criteria of the transfer type and direction, to allow variations of the devices.


    The outline of the modification is as follows,

    In the "USB Host - MCHPUSB - Generic Driver Demo" example (v2.7a - v2010-08-04)

    a) VID/PID
    Change VID/PID of TPL, to specify the target device.
    usb_config.c

    USB_TPL usbTPL[] =
    {
        { INIT_VID_PID( 0x045Eul, 0x028Eul ), 0, 0, {0} }, // <------- change VID/PID to the target device
    };



    b) Endpoint address
    XBox360 controller uses EP1 IN and EP2 OUT for the first interface.
    But usb_host_generic.c hardcode the endpoints as EP1 IN and EP1 OUT.
    We have to fix them up.

    Copy usb_host_generic.c from this folder to your project folder. And rename it to usb_host_generic_mod.c
    C:\Microchip Solutions v2010-08-04\Microchip\USB\Generic Host Driver\
    On Microchip IDE, replace usb_host_generic.c on the workspace into usb_host_generic_mod.c

    Define the endpoint addresses in usb_config.h
    usb_config.h

    #define USB_GENERIC_IN_EP     0x81
    #define USB_GENERIC_OUT_EP    0x02


    On usb_host_generic_mod.c, find "USB_GENERIC_EP" and replace them as follows.

    USB_IN_EP|USB_GENERIC_EP  ---> USB_GENERIC_IN_EP
    USB_OUT_EP|USB_GENERIC_EP ---> USB_GENERIC_OUT_EP

    You'll see six "USB_GENERIC_EP" in this file.


    c) Main state machine
    The workhorse of this code is the state machine in ManageDemoState() (main.c)
    Delete the states, from DEMO_STATE_GET_DEV_VERSION to DEMO_STATE_UPDATE_LED_STATE,
    and replace them with your custom states.
    main.c

    // Application States
    typedef enum
    {
        DEMO_INITIALIZE = 0,                // Initialize the app when a device is attached
        DEMO_STATE_IDLE,                    // Inactive State

    /*                                                     // <---------- Replace these states into yours
        DEMO_STATE_GET_DEV_VERSION,         // New device attached, send Get-Dev-FW-Version command
        ...
        ...
        DEMO_STATE_UPDATE_LED_STATE,        // Set-LED command successful, update state.
    */

        DEMO_STATE_ERROR                    // An error has occured

    } DEMO_STATE;


    void ManageDemoState ( void )
    {
        ...
        ...
        case DEMO_STATE_IDLE:
            if (CheckForNewAttach())
            {
                DemoState = DEMO_STATE_GET_DEV_VERSION;
            }
            break;

    /*                                                     // <---------- Replace these states into yours
        case DEMO_STATE_GET_DEV_VERSION:
        ...
        ...
        case DEMO_STATE_UPDATE_LED_STATE:
            break;
    */
        /** Error state:  Hold here until detached **/
        case DEMO_STATE_ERROR:                          // To Do: Flash LEDs
            break;
        ...
        ...


    A template of RX states is here.
    Please note, USBHostGenericRead() always requests the greatest size among the input reports (MAX_INPUT_SIZE)

        case DEMO_STATE_ENTRY_RX:
            if (!USBHostGenericRxIsBusy(deviceAddress))
            {
                if ( (RetVal=USBHostGenericRead(deviceAddress, &DataPacket, MAX_INPUT_SIZE)) == USB_SUCCESS)
                {
                    DemoState = DEMO_STATE_WAITING_RX;
                }
                else
                {
        #ifdef DEBUG_MODE
                    UART2PrintString( "2 Device Read Error 0x" );
                    UART2PutHex(RetVal);
                    UART2PrintString( "\r\n" );
        #endif
                }
            }
            break;

        case DEMO_STATE_WAITING_RX:
            if (!USBHostGenericRxIsBusy(deviceAddress))
            {
                //
                // The packet is received on DataPacket[] successfully.
                // The actual packet size is gc_DevData.rxLength
                // parse it
                //

                // Move to NEXT_STATE
                DemoState = DEMO_STATE_NEXT_STATE;
            }
            break;


    A template of TX states is here.

        case DEMO_STATE_ENTRY_TX:
            if (!USBHostGenericTxIsBusy(deviceAddress))
            {
                //
                // make up a packet on DataPacket[], here
                // TX_Packet_size holds the size of the packet
                //

                if ( (RetVal=USBHostGenericWrite(deviceAddress, &DataPacket, TX_Packet_size)) == USB_SUCCESS)
                {
                    DemoState = DEMO_STATE_WAITING_TX;
                }
                else
                {
        #ifdef DEBUG_MODE
                    UART2PrintString( "2 Device Write Error 0x" );
                    UART2PutHex(RetVal);
                    UART2PrintString( "\r\n" );
        #endif
                }
            }
            break;

        case DEMO_STATE_WAITING_TX:
            if (!USBHostGenericTxIsBusy(deviceAddress) )
            {
                //
                // The packet is sent successfully.
                // Move to NEXT_STATE
                //
                DemoState = DEMO_STATE_NEXT_STATE;
            }
            break;



    Lastly, don't forget to increase the DATA_PACKET_LENGTH, so that all input/output reports fit to this buffer.
    user.h

    #define DATA_PACKET_LENGTH  0x20             // DataPacket[] size


    Tsuneo
    #5
    cutemonster
    Junior Member
    • Total Posts : 93
    • Reward points : 0
    • Joined: 2009/03/22 22:01:17
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2010/09/17 10:49:46 (permalink)
    0
    Thank you so much Tsuneo.
    You're always here to help.
    I wonder what you do in your career?  You've help hundreds of users everywhere including this forum.

    Will you take freelance job?

    thanks again,

    #6
    Milbman
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2010/10/12 16:35:37
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2010/10/19 09:54:44 (permalink)
    0
    I say it, too: Thank you so much Tsuneo!
    I tried it with the generic example, but it dosn't work - couldn't write anything to my gamepad  - then i found your post and it works also for my "Logitech Chillstream" which is very similar with the xbox 360 Controller.
    #7
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/01/20 14:18:36 (permalink)
    0
    chinzei

    ...Start with "USB Host - MCHPUSB - Generic Driver Demo" example, instead of Host HID example.
    Then, you don't need to worry about the HID parser any more wink

    But I think the problem lies in the hub integrated into the controller (compound device).

    This web page tells that the original Xbox Controller is a compound device (ie. with hub)

    Inside Xbox Controller
    http://euc.jp/periphs/xbox-controller.ja.html

    Does Xbox 360 controller also have a hub?
    If so, you have to enumerate the hub, first.

    Tsuneo


    Hi Tsuneo,

    I have a similar problem, a Joystick controller with an integrated 4-port-USB-Hub. I dived into the sample code and at every stage where it gets interesting, it just says "Hubs are not supported". Attached are the descriptor files for the Flight Yoke and its Hub.
    Can you give me a hint which steps I need to take to be able to access the device and deal with it, although it has the Hub built in?
    You wrote "you have to enumerate the hub, first", how do I do that, and how do I have to proceed then?

    Many thanks in advance for your help,
    very much appreciated!
    Cheers,
    Hartwig

    #8
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:receive report without hid report descriptor? 2011/01/21 21:00:00 (permalink)
    0
    You wrote "you have to enumerate the hub, first", how do I do that, and how do I have to proceed then?


    Microchip host stack doesn't support hub and devices under hub yet. On the current version (v2010-10-19), extensions for multi-device support are seen here and there, but the stack still requires significant change for complete support of hub. PIC host controller (both on PIC24F and on PIC32) has a silicon bug on PRE packet, which is required for low-speed device over hub. I believe it is one of the reason that they stop development of hub support on the host stack temporalily.

    While you are waiting for the complete support of hub from Microchip, I believe you may still run the compound device (ie. integrated hub) on the current host stack. On compound device, the device under hub doesn't detach. Therefore, the host firmware does't need to watch hub status, once the hub and the target device is enumerated. Ya, it's a dirty implementation for personal project wink In this policy, you don't need to modify the host stack so significantly, because the host stack works with just one device at a time.

    I've shown about hub operation sequence on this post.
    http://www.microchip.com/forums/fb.ashx?m=523499

    The outline of the modification is as follows,
    1) On device attach, enumerate the hub on the device
    - you may need to modify usb_host.c a little, to allow it enumerate hub class.

    2) Put this request sequence to the hub to enable and reset the target device on a hub port
    - Set_Port_Feature (PortN, PORT_POWER)
    - delay for 100ms or so
    - Repeat Get_Port_Status (PortN), until C_PORT_CONNECTION raises
    - Clear_Port_Feature (PortN, C_PORT_CONNECTION)
    - delay for 100ms
    - Set_Port_Feature (PortN, PORT_RESET)
    - Repeat Get_Port_Status (PortN), until C_PORT_RESET raises
    - Clear_Port_Feature (PortN, C_PORT_RESET)

    The SETUP data for these requests are shown in above post.

    3) Put Set_Address to the target device
    Copy the code from this section of usb_host.c
    case STATE_ADDRESSING: / case SUBSTATE_SET_DEVICE_ADDRESS:
    and modify it as follows,
     
        usbDeviceInfo.deviceAddress = 0x02:   // USB_SINGLE_DEVICE_ADDRESS;
        usbDeviceInfo.deviceAddressAndSpeed = 0x00;

        // Set up and send SET ADDRESS
        pEP0Data[0] = USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE;
        pEP0Data[1] = USB_REQUEST_SET_ADDRESS;
        pEP0Data[2] = usbDeviceInfo.deviceAddress;
        pEP0Data[3] = 0;
        pEP0Data[4] = 0;
        pEP0Data[5] = 0;
        pEP0Data[6] = 0;
        pEP0Data[7] = 0;
        _USB_InitControlWrite( usbDeviceInfo.pEndpoint0, pEP0Data, 8, NULL, 0 );
        // _USB_SetNextSubSubState();
        usbHostState = STATE_ADDRESSING | SUBSUBSTATE_WAIT_FOR_SET_DEVICE_ADDRESS;


    Now, the host stack returns to usual operation without hub.


    In above step 2), you should know the port number (PortN) of the hub, to which the target device attaches. You'll see it on the sniffer trace on PC for enumeration of the device.
    What is the port number?

    Tsuneo
    post edited by chinzei - 2011/01/21 21:30:57
    #9
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/01/23 03:50:12 (permalink)
    0
    chinzei...In above step 2), you should know the port number (PortN) of the hub, to which the target device attaches. You'll see it on the sniffer trace on PC for enumeration of the device.
    What is the port number?

    Tsuneo


    Many many thanks for your help again! :-)
    It is Port #4. The remaining 3 inputs are receptacles on the outside of the device's case. I will try the steps that you recommended and hopefully get back with a result == success :-)
    Actually getting the device to work through the built in Hub is only the first step. I need to serve at least two devices, as the joystick is a set that is made up of two units, the one with the built in Hub, and anotherone that gets attached to the Hub and therefore "looped through" to the Host.
    But first I will follow your guideline to get the built in device working, and get back when I have news on this step.

    Many Thanks for your great help!
    Cheers,
    Hartwig
    #10
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/02/15 13:10:33 (permalink)
    0
    Hello Tsuneo,

    I have tried to implement your guidelines, added the Hub class to the TPL, but unfortunately I got stuck already by retrieving the Hub Descriptor. This is what the Debug Info spits out so far:
    HOST: Getting Device Descriptor size.
    !!!HOST: Getting device descriptor.
    !!!HOST: Validating VID and PID.
    HOST: Device validated by class
    HOST: Setting device address.
    !!HOST: Getting Config Descriptor size.
    !!!HOST: Getting Config Descriptor.
    !!!HOST: Parse Descriptor success
    HOST: Determine OTG capability.
    HOST: ...No OTG.
    HOST: Set configuration.
    !!HOST: Initializing client drivers...
    HOST: Using device client driver.

    Do I need to create another set of substates and subsubstates in the main state machine for retrieving the Hub Descriptor, as it is done for the the device descriptor for example? As far as I understand your outline of the setup packets in the thread which you linked to, I need to make a couple control writes to Endpoint0 and reget the responce via Control Read, is that correct? Sorry for the mess, I am a bit confused at this point.
    Any help would be greatly appreciated.

    Cheers,
    Hartwig
    #11
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/04/12 12:43:00 (permalink)
    0
    chinzei
    ...
    I've shown about hub operation sequence on this post.
    http://www.microchip.com/forums/fb.ashx?m=523499

    The outline of the modification is as follows,
    1) On device attach, enumerate the hub on the device
    - you may need to modify usb_host.c a little, to allow it enumerate hub class.

    2) Put this request sequence to the hub to enable and reset the target device on a hub port
    - Set_Port_Feature (PortN, PORT_POWER)
    - delay for 100ms or so
    - Repeat Get_Port_Status (PortN), until C_PORT_CONNECTION raises
    - Clear_Port_Feature (PortN, C_PORT_CONNECTION)
    - delay for 100ms
    - Set_Port_Feature (PortN, PORT_RESET)
    - Repeat Get_Port_Status (PortN), until C_PORT_RESET raises
    - Clear_Port_Feature (PortN, C_PORT_RESET)

    The SETUP data for these requests are shown in above post.

    3) Put Set_Address to the target device
    Copy the code from this section of usb_host.c
    case STATE_ADDRESSING: / case SUBSTATE_SET_DEVICE_ADDRESS:
    and modify it as follows,
      
       usbDeviceInfo.deviceAddress = 0x02:   // USB_SINGLE_DEVICE_ADDRESS;
       usbDeviceInfo.deviceAddressAndSpeed = 0x00;

       // Set up and send SET ADDRESS
       pEP0Data[0] = USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE;
       pEP0Data[1] = USB_REQUEST_SET_ADDRESS;
       pEP0Data[2] = usbDeviceInfo.deviceAddress;
       pEP0Data[3] = 0;
       pEP0Data[4] = 0;
       pEP0Data[5] = 0;
       pEP0Data[6] = 0;
       pEP0Data[7] = 0;
       _USB_InitControlWrite( usbDeviceInfo.pEndpoint0, pEP0Data, 8, NULL, 0 );
       // _USB_SetNextSubSubState();
       usbHostState = STATE_ADDRESSING | SUBSUBSTATE_WAIT_FOR_SET_DEVICE_ADDRESS;


    Now, the host stack returns to usual operation without hub.
    ...
    Tsuneo


    For some reason I only get up to 2). I set the device address to 0x02 as shown in the post above, but when it comes to Parse the configuration Descriptor, I find that I am still talking to the Hub, not to the device. The configuration descriptor is still that of the Hub, and _USB_ParseConfigurationDescriptor( void ) stalls at this point.
    Any chance you can outline a little more detailed how to accomplish part 3) and how to proceed for enumerating the device?
    Please help.
    Cheers,
    Hartwig
    #12
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/04/13 12:03:40 (permalink)
    0
    Hi Tsuneo,

    I don't even get to the point where I can talk to the device so that I could set its address to 0x02.

    For example, after the corresponding C_PORT_RESET flag has fallen, no matter which address I use to talk to the device which is connected to port#4 of the Hub, I always get the response from the Hub, not from the device.


        //----------------------------------------------------------------------------------------------------
            #define CUR_ADR                    0x00

            #ifdef DEBUG_MODE
                UART2PrintString( "HOST: Getting Device Descriptor size. address\t0x" );
                UART2PutHex( CUR_ADR );
            #endif

            USBHostSetHostState( CUR_ADR );

            error = (USBHostIssueDeviceRequest(
                       CUR_ADR,                                                                                                                          // BYTE deviceAddress,
                       USB_SETUP_DEVICE_TO_HOST | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE,     // BYTE bmRequestType,
                                                USB_REQUEST_GET_DESCRIPTOR,                                                                 // BYTE bRequest,
                                                (USB_DESCRIPTOR_DEVICE << 8),                                                                 // WORD wValue,
                                                0,                                                                                                            // WORD wIndex,
                                                0x12,                                                                                                       // WORD wLength,
                                                buf,                                                                                                         // BYTE *data,
                                                USB_DEVICE_REQUEST_GET,                                                                         // BYTE dataDirection,
                                                deviceInfoHID[device].ID.clientDriverID ));                                                       // BYTE clientDriverID
            if(error)
            {
                #ifdef DEBUG_MODE
                    UART2PrintString("\r\nHID: USBHostIssueDeviceRequest FAILED! Error code: 0x" );
                    UART2PutHex(error);
                    UART2PrintString("\r\n\r\n" );
                #endif
            }
            else
            {
            // delay 100ms
                lWait = dly100ms;
                while (lWait--);

                #ifdef DEBUG_MODE
                    UART2PrintString("\r\nDevice Descriptor:\r\n" );
                    UART2PrintString( "\r\nDEVICE_DESCRIPTOR[0x00]:\t" );
                    UART2PutHex(buf[0]);
                    UART2PrintString( "\r\nDEVICE_DESCRIPTOR[0x01]:\t" );
                    UART2PutHex(buf[1]);
                    ...
             }


    The returned Device Descriptor is:
    DEVICE_DESCRIPTOR[0x00]:    12
    DEVICE_DESCRIPTOR[0x01]:    01
    DEVICE_DESCRIPTOR[0x02]:    00
    DEVICE_DESCRIPTOR[0x03]:    02
    DEVICE_DESCRIPTOR[0x04]:    09
    DEVICE_DESCRIPTOR[0x05]:    00
    DEVICE_DESCRIPTOR[0x06]:    00
    DEVICE_DESCRIPTOR[0x07]:    40
    DEVICE_DESCRIPTOR[0x08]:    A3
    DEVICE_DESCRIPTOR[0x09]:    06
    DEVICE_DESCRIPTOR[0x0A]:    2C
    DEVICE_DESCRIPTOR[0x0B]:    71
    DEVICE_DESCRIPTOR[0x0C]:    01
    DEVICE_DESCRIPTOR[0x0D]:    01
    DEVICE_DESCRIPTOR[0x0E]:    00
    DEVICE_DESCRIPTOR[0x0F]:    00
    DEVICE_DESCRIPTOR[0x10]:    00
    DEVICE_DESCRIPTOR[0x11]:    01

    ...which is the Hub's DevDesc. (=> "DEVICE_DESCRIPTOR[0x04]:    09" == Hub-Class)

    Any idea what I need to do to get a handle on the attached device?

    I have been trying for several days now to get this running, but I am totally stuck. How do I "switch" to the device? Please help!

    Hartwig

    #13
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/04/14 07:30:24 (permalink)
    0
    chinzei
       ... 
    -- 100ms after connection, reset the target port --

    Set Port Feature (Port4, PORT_RESET)            23 03 04 00 04 00 00 00   --- (6)
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
               11 01 00 00        PORT_CONNECTION, PORT_RESET, PORT_POWER

    Interrupt-IN - Hub Status Change
               10         Port4
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
               03 01 10 00        PORT_CONNECTION, PORT_ENABLE, PORT_POWER, C_PORT_RESET
    Clear Port Feature (Port4, C_PORT_RESET)        23 01 14 00 04 00 00 00
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
               03 01 00 00        PORT_CONNECTION, PORT_ENABLE, PORT_POWER

    -- Enumeration of target device --
    Get Device Descriptor                                                     --- (7)
    Set Address (0x04)
    ...
    ...

    -- Hub ports watch, periodical --
                                                                            --- (8)

    ...
    (6) After 100 ms or more delay,
    Start Bus Reset on the target port
    Wait for the end of bus reset, by polling hub status.
    When Bus Reset finishes, hub notifies it using C_PORT_RESET flag
    Clear this flag, and confirm if it drops

    (7) By the Bus Reset, device falls into the default device state (device address 0)
    Start enumeration of the target device, as if it is plugged in to the host port, directly.

    (8) Return to port watch
    ...

    Tsuneo


    Getting the Hub's port status works smooth and all Set feature and Clear feature requests work fine, but the big question is:
    What parameters do I need to modify in order to access the Device that is attached to that port of the Hub?

    In (7) it says:
    "device falls into the default device state (device address 0)
    Start enumeration of the target device, as if it is plugged in to the host port, directly"
    Now when right after verifying that "C_PORT_RESET flag " has dropped, I use

    usbDeviceInfo.deviceAddress = 0x00;
    usbHostState = (STATE_ATTACHED | SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE | SUBSUBSTATE_SEND_GET_DEVICE_DESCRIPTOR_SIZE);

    to set the USB Host's state to start enumerating the device. But as a result it enumerates the Hub again.

    I inserted a few lines to get some more debug information at the UART2 output; This is what I get:

    Initialization completed!
    Entering Main Loop...

    HOST: Initializing DETACHED state.

    -InDevLoadDefaultSettings

    ***** EVENT_VBUS_REQUEST_POWER
    [>HOST: Starting settling delay.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    HOST: Getting device descriptor.
    HOST: Validating VID and PID.
    HOST: Device validated by class
    HOST: Setting device address.
    HOST: usbDeviceInfo.deviceAddress:        01
    HOST: usbDeviceInfo.deviceAddressAndSpeed:    00
    HOST: usbDeviceInfo.deviceAddress:        01
    HOST: usbDeviceInfo.deviceAddressAndSpeed:    01

    HOST: Getting Config Descriptor size.
    HOST: Getting Config Descriptor.

    ***** EVENT_VBUS_REQUEST_POWER
    HOST: Parse Descriptor success
    HOST: Determine OTG capability.
    HOST: ...No OTG.
    HOST: Set configuration.
    HOST: Initializing client drivers...
    HOST: Using device client driver.

    USBHostHUBInitialize
    USBHostHUB at address                0x01

    Getting Hub Descriptor

    bDescLength        0x09
    DescriptorType        0x29
    bNbrPorts            0x04
    wHubCharacteristics    0x0000
    PwrOn2PwrGood        0x64
    bHubContrCurrent        0x00
    DeviceRemovable        0xFF    0x00    0x00    0x00    0x00    0x00    0x00    0x00
    pwrCtlPortFlags        0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00

    Port 04:   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_CONNECTION   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_POWER    PS_PORT_LOW_SPEED   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_RESET   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_RESET   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED   


    HOST: Getting Device Descriptor at address    0x00
    HOST: Getting Device Descriptor size.
    HOST: Getting device descriptor.

    DEVICE_DESCRIPTOR[0x00]:    12
    DEVICE_DESCRIPTOR[0x01]:    01
    DEVICE_DESCRIPTOR[0x02]:    00
    DEVICE_DESCRIPTOR[0x03]:    02
    DEVICE_DESCRIPTOR[0x04]:    09
    DEVICE_DESCRIPTOR[0x05]:    00
    DEVICE_DESCRIPTOR[0x06]:    00
    DEVICE_DESCRIPTOR[0x07]:    40
    DEVICE_DESCRIPTOR[0x08]:    09
    DEVICE_DESCRIPTOR[0x09]:    04
    DEVICE_DESCRIPTOR[0x0A]:    5A
    DEVICE_DESCRIPTOR[0x0B]:    00
    DEVICE_DESCRIPTOR[0x0C]:    00
    DEVICE_DESCRIPTOR[0x0D]:    01
    DEVICE_DESCRIPTOR[0x0E]:    00
    DEVICE_DESCRIPTOR[0x0F]:    00
    DEVICE_DESCRIPTOR[0x10]:    00
    DEVICE_DESCRIPTOR[0x11]:    01

    HOST: Validating VID and PID.
    HOST: Device validated by class
    HOST: Setting device address.
    ^=HOST: Setting device address.
    ^=HOST: Setting device address.
    ^=HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Holding.

     USB_CANNOT_ENUMERATE
    ***** USB Error - cannot enumerate device *****




    Can anyone please point me in the right direction? Since talking to the Hub works all fine I have a feeling that I'm really close, just something is still keeping me from accessing the device, hence from enumerating it.

    Please help...

    Cheers,
    Hartwig

    #14
    Hartwig
    Starting Member
    • Total Posts : 53
    • Reward points : 0
    • Joined: 2010/05/19 03:57:54
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2011/04/20 07:07:15 (permalink)
    0
    Hartwig

    chinzei
       ...  
    -- 100ms after connection, reset the target port --

    Set Port Feature (Port4, PORT_RESET)            23 03 04 00 04 00 00 00   --- (6)
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
              11 01 00 00        PORT_CONNECTION, PORT_RESET, PORT_POWER

    Interrupt-IN - Hub Status Change
              10         Port4
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
              03 01 10 00        PORT_CONNECTION, PORT_ENABLE, PORT_POWER, C_PORT_RESET
    Clear Port Feature (Port4, C_PORT_RESET)        23 01 14 00 04 00 00 00
    Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
              03 01 00 00        PORT_CONNECTION, PORT_ENABLE, PORT_POWER

    -- Enumeration of target device --
    Get Device Descriptor                                                     --- (7)
    Set Address (0x04)
    ...
    ...

    -- Hub ports watch, periodical --
                                                                           --- (8)

    ...
    (6) After 100 ms or more delay,
    Start Bus Reset on the target port
    Wait for the end of bus reset, by polling hub status.
    When Bus Reset finishes, hub notifies it using C_PORT_RESET flag
    Clear this flag, and confirm if it drops

    (7) By the Bus Reset, device falls into the default device state (device address 0)
    Start enumeration of the target device, as if it is plugged in to the host port, directly.

    (8) Return to port watch
    ...

    Tsuneo


    Getting the Hub's port status works smooth and all Set feature and Clear feature requests work fine, but the big question is:
    What parameters do I need to modify in order to access the Device that is attached to that port of the Hub?

    In (7) it says:
    "device falls into the default device state (device address 0)
    Start enumeration of the target device, as if it is plugged in to the host port, directly"
    Now when right after verifying that "C_PORT_RESET flag " has dropped, I use
     
    usbDeviceInfo.deviceAddress = 0x00;
    usbHostState = (STATE_ATTACHED | SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE | SUBSUBSTATE_SEND_GET_DEVICE_DESCRIPTOR_SIZE);

    to set the USB Host's state to start enumerating the device. But as a result it enumerates the Hub again.

    I inserted a few lines to get some more debug information at the UART2 output; This is what I get:
     
    Initialization completed!
    Entering Main Loop...

    HOST: Initializing DETACHED state.

    -InDevLoadDefaultSettings

    ***** EVENT_VBUS_REQUEST_POWER
    [>HOST: Starting settling delay.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    HOST: Getting device descriptor.
    HOST: Validating VID and PID.
    HOST: Device validated by class
    HOST: Setting device address.
    HOST: usbDeviceInfo.deviceAddress:        01
    HOST: usbDeviceInfo.deviceAddressAndSpeed:    00
    HOST: usbDeviceInfo.deviceAddress:        01
    HOST: usbDeviceInfo.deviceAddressAndSpeed:    01

    HOST: Getting Config Descriptor size.
    HOST: Getting Config Descriptor.

    ***** EVENT_VBUS_REQUEST_POWER
    HOST: Parse Descriptor success
    HOST: Determine OTG capability.
    HOST: ...No OTG.
    HOST: Set configuration.
    HOST: Initializing client drivers...
    HOST: Using device client driver.

    USBHostHUBInitialize
    USBHostHUB at address                0x01

    Getting Hub Descriptor

    bDescLength        0x09
    DescriptorType        0x29
    bNbrPorts            0x04
    wHubCharacteristics    0x0000
    PwrOn2PwrGood        0x64
    bHubContrCurrent        0x00
    DeviceRemovable        0xFF    0x00    0x00    0x00    0x00    0x00    0x00    0x00
    pwrCtlPortFlags        0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00

    Port 04:   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_CONNECTION   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_POWER    PS_PORT_LOW_SPEED   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_RESET   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED    PS_C_PORT_RESET   


    Port 04:    PS_PORT_CONNECTION    PS_PORT_ENABLE    PS_PORT_POWER    PS_PORT_LOW_SPEED   


    HOST: Getting Device Descriptor at address    0x00
    HOST: Getting Device Descriptor size.
    HOST: Getting device descriptor.

    DEVICE_DESCRIPTOR[0x00]:    12
    DEVICE_DESCRIPTOR[0x01]:    01
    DEVICE_DESCRIPTOR[0x02]:    00
    DEVICE_DESCRIPTOR[0x03]:    02
    DEVICE_DESCRIPTOR[0x04]:    09
    DEVICE_DESCRIPTOR[0x05]:    00
    DEVICE_DESCRIPTOR[0x06]:    00
    DEVICE_DESCRIPTOR[0x07]:    40
    DEVICE_DESCRIPTOR[0x08]:    09
    DEVICE_DESCRIPTOR[0x09]:    04
    DEVICE_DESCRIPTOR[0x0A]:    5A
    DEVICE_DESCRIPTOR[0x0B]:    00
    DEVICE_DESCRIPTOR[0x0C]:    00
    DEVICE_DESCRIPTOR[0x0D]:    01
    DEVICE_DESCRIPTOR[0x0E]:    00
    DEVICE_DESCRIPTOR[0x0F]:    00
    DEVICE_DESCRIPTOR[0x10]:    00
    DEVICE_DESCRIPTOR[0x11]:    01

    HOST: Validating VID and PID.
    HOST: Device validated by class
    HOST: Setting device address.
    ^=HOST: Setting device address.
    ^=HOST: Setting device address.
    ^=HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Resetting the device.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HOST: Reset complete.
    HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Getting Device Descriptor size.
    #10#10#10#10#10#10#10#10#10#10=HOST: Holding.

    USB_CANNOT_ENUMERATE
    ***** USB Error - cannot enumerate device *****




    Can anyone please point me in the right direction? Since talking to the Hub works all fine I have a feeling that I'm really close, just something is still keeping me from accessing the device, hence from enumerating it.

    Please help...

    Cheers,
    Hartwig




    Got it resolved! Smile The same buffers that I used to receive the descriptors of the Hub, I used for the device as well. For some reason they were not overwritten with the new data, instead they have to be cleared prior to sending requests to the device. Therefore actually all my attemtps to access the device were successful, but the buffers were not updated. Clearing them before the request solved the issue.
    Hartwig
    #15
    portsetsystems
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2012/08/01 08:29:56
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2012/08/01 08:56:46 (permalink)
    0
    I have for some time been trying to access the keyboard device descriptor of a Monster keyboard using a Pic24fj64gb002 but all I get is the details of the Hub. I have added STATE_HUB after CLIENT_DRIVERS and all the PORT_FEATURE/ CLEAR PORT etc as SUBSTATES. It says Getting Device Descriptor at address    0x00  but Device Descriptor does not appear to have an entry for Address. Also Chinzei's example shows it looping back to STATE_ADDRESSING but that comes after Get Device Descriptor? Can anyone help please?
    #16
    MVR
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2012/08/10 16:30:05
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2012/08/25 21:33:09 (permalink)
    0
    Hi portsetsystems

    We're you able to proceed further
    I am too struck in this step for a long time. Do you have any pointers to help me out?

    Thanks
    Mvr
    #17
    portsetsystems
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2012/08/01 08:29:56
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2012/08/27 03:45:25 (permalink)
    0
    Hi Mvr,
    No I am still stuck with this problem. Like you I assumed "clearing buffers" related to pDescriptor and pEpData0. I even tried creating new buffers for the GetDeviceDescriptor after setting the port but still got details for Hub. Chinsei - in his original says Get Hub descriptor after SetConfig, but what about INIT_CLIENT_DRIVERS which gets the Endpoints. Should this come before HubDescriptor? ie must you get endpoint for Hub before it accesses Device? I don't know its very frustrating. I have tried numerous ways but always end up with just the Hub details.
     
    regards
    Keith
    #18
    MVR
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2012/08/10 16:30:05
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2012/08/27 05:40:11 (permalink)
    0
    Hi Keith,
    I share the frustration, i too tried numerous ways but still it gets the hub details. However thanks for the pointer, INIT_CLIENT_DRIVERS needs to be tried before getting hub descriptor. I will try this now and update you soon.
    Thanks
    mvr
    #19
    MVR
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2012/08/10 16:30:05
    • Location: 0
    • Status: offline
    Re:receive report without hid report descriptor? 2012/08/27 05:52:14 (permalink)
    0
    I just tried calling the SUBSUBSTATE_INIT_CLIENT_DRIVERS before getting Hub Descriptor but didn't work out.
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5