• AVR Freaks

Helpful ReplyProblem Enumerating Hub-Attached Devices

Author
picture2x
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2010/09/07 23:40:46
  • Location: 0
  • Status: offline
2010/09/07 23:57:29 (permalink)
0

Problem Enumerating Hub-Attached Devices

Good day everyone, I'm creating a hub driver for PIC32 for educational purposes and I have a problem in enumerating hub-attached devices. It seems that whenever I send Get_Descriptor command for checking the size of the descriptor, the device that receives this command is the hub itself. 

The way I did it is to first poll the status change descriptor of the hub. When a device is attached, the status change will report it and I send Get_Status first to get status bits of the hub, then i send Clear_Feature(C_PORT_CONNECTION) after. I then check if the status bit changes correspond to this then I send a Set_Feature(PORT_RESET) after this and send a Get_Status to check if it changes and cleared the port reset via Clear_Feature(PORT_RESET). I then proceed to send Get_Descriptor to endpoint0 but this is where the problem starts. 

Another question, what are the conditions that I need so that the device itself will receive the commands I send at endpoint0?


#1
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/08 07:07:58 (permalink)
+2 (1)

When a device is attached, the status change will report it and I send Get_Status first to get status bits of the hub, then i send Clear_Feature(C_PORT_CONNECTION) after. I then check if the status bit changes correspond to this then I send a Set_Feature(PORT_RESET) after this and send a Get_Status to check if it changes and cleared the port reset via Clear_Feature(PORT_RESET).

It seems on the right track.
The last request is Clear_Feature( C_PORT_RESET )
Hub stops the bus reset period by itself, without any request from the host. Host orders just the start of the reset period to the hub.
C_PORT_RESET flag notifies the end of bus reset period to the host.
Host clears this flag by Clear_Feature( C_PORT_RESET )

I then proceed to send Get_Descriptor to endpoint0 but this is where the problem starts.

whenever I send Get_Descriptor command for checking the size of the descriptor, the device that receives this command is the hub itself.

You should get the descriptor of the target device.
At least, you got a descriptor, though it isn't a right one.
Just the problem of the device address.

a) Is the Get_Descriptor really issued to device address 0?
OR
b) Is the hub assigned to a device address other than 0, on its enumeration?

A hardware bus analyzer immediately answers to above questions.

Tsuneo
#2
picture2x
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2010/09/07 23:40:46
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/09 01:49:58 (permalink)
0
Ok thank you very much sir for the reply. I will use a bus analyzer for my concerns.

By the way, the reason that I found that it is the hub that is getting the get device descriptor command is that whenever I check the data received at the endpoint and checking the contents, the bdeviceClass value that is returned is that of the Hub class.
post edited by picture2x - 2010/09/09 01:51:41
#3
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/09 14:37:39 (permalink)
0
Here is a short summary of hub operation sequences

The first one is the enumeration sequence of hub itself.

   -- Plug-in of a hub, enumeration of hub --
                                                SETUP data
Bus Reset                                                                 --- (1)
Get Device Descriptor                           80 06 00 01 00 00 08 00
Set Address (0x03)                              00 05 03 00 00 00 00 00
Get Device Descriptor                           80 06 00 01 00 00 12 00
Get Configuration Descriptor                    80 06 00 02 00 00 04 00
Get Configuration Descriptor                    80 06 00 02 00 00 19 00
Set Configuration (0x01)                        00 09 01 00 00 00 00 00

Get Descriptor (Hub)                            A0 06 00 29 00 00 17 00   --- (2)
             09 29 04 00 00 32 40 00 1E
Set Port Feature (Port1, PORT_POWER)            23 03 08 00 01 00 00 00   --- (3)
Set Port Feature (Port2, PORT_POWER)            23 03 08 00 02 00 00 00
Set Port Feature (Port3, PORT_POWER)            23 03 08 00 03 00 00 00
Set Port Feature (Port4, PORT_POWER)            23 03 08 00 04 00 00 00

   -- Hub ports watch, periodical --
Interrupt-IN (Hub Status Change EP) (0x81)                                --- (4)
   -- optionally, repeated port scan --
Get Port Status (Port1)                         A3 00 00 00 01 00 04 00
             00 01 00 00        PORT_POWER
Get Port Status (Port2)                         A3 00 00 00 02 00 04 00
             00 01 00 00        PORT_POWER
Get Port Status (Port3)                         A3 00 00 00 03 00 04 00
             00 01 00 00        PORT_POWER
Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
             00 01 00 00        PORT_POWER

(1) When a hub is plugged in to a host port, host enumerates the hub, as usual.
The enumeration sequence from Bus Reset to Set_Configuration is same as other devices.
(2) After Set_Configuration, read out Hub Descriptor, to know the number of ports on the hub.
Above example shows 4 ports hub.
(3) Enable VBUS power on each port
(4) Start port watch by polling hub's interrupt IN endpoint, periodically
Optionally, ports are scanned periodically using Get_Port_Status, too


This sequence shows plug-in of a device to a hub port (port 4)

   -- Plug-in of a device on a hub port, enumeration of the device --

Interrupt-IN (Hub Status Change EP) (0x81)                                --- (5)
             10         Port4
Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
             01 01 01 00        PORT_CONNECTION, PORT_POWER, C_PORT_CONNECTION
Clear Port Feature (Port4, C_PORT_CONNECTION)   23 01 10 00 04 00 00 00
Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
             01 01 00 00        PORT_CONNECTION, PORT_POWER

   -- 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)

(5) Interrupt IN endpoint notifies status change on port 4
Get_Port_Status reports PORT_CONNECTION and C_PORT_CONNECTION
Clear C_PORT_CONNECTION flag
Confirm if C_PORT_CONNECTION drops

(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


The last one is device detach sequence

   -- device detaches from the hub --

Interrupt-IN - Hub Status Change                                          --- (9)
             10         Port4
Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
             00 01 01 00        PORT_POWER, C_PORT_CONNECTION
Clear Port Feature (Port4, C_PORT_CONNECTION)   23 01 10 00 04 00 00 00
Get Port Status (Port4)                         A3 00 00 00 04 00 04 00
             00 01 00 00        PORT_POWER

   -- return to port watch --

(9) Interrupt IN EP notifies status change on the target port
Read out the status of the port, C_PORT_CONNECTION flag is reported.
Clear this flag, and confirm if it drops.


This short summary doesn't cover,
- Power status change of hub (bus-/self-powered, overcurrent)
- Remote Wakeup
- (Selective) Suspend / Resume

Tsuneo
post edited by chinzei - 2010/09/09 15:38:12
#4
picture2x
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2010/09/07 23:40:46
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/12 02:53:02 (permalink)
0

Oh thanks a lot for the info Tsuneo.

Just found out that the Get_Descriptor command is not issued on device address 0 but address 1, it fixed my problem. :)
#5
picture2x
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2010/09/07 23:40:46
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/20 21:21:56 (permalink) ☄ Helpful
0
I have another problem.

After enumeration of the hub attached ( I tried an MSD ) device, a problem occurred wherein I am unable to read the status change bits of the hub. I don't know causes this. Help please :(
#6
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/22 04:42:13 (permalink)
0
When a new device is enumerated, the device information on usbDeviceInfo (usb_host.c) is overwritten to the new device. And then, we lose the access to previous device.

The current version of Microchip host stack (v2.7a, v2010-08-04) doesn't finish multiple devices support yet. It is still in progress.
usb_host.c has to be re-configured significantly.

1) Static globals on usb_host.c
As the comment on this file tells, these static globals should be members of USB_DEVICE_INFO structure
usb_host.c

// These should all be moved into the USB_DEVICE_INFO structure.
static BYTE                          countConfigurations;                        // Count the Configuration Descriptors read during enumeration.
static BYTE                          numCommandTries;                            // The number of times the current command has been tried.
static BYTE                          numEnumerationTries;                        // The number of times enumeration has been attempted on the attached device.
static volatile WORD                 numTimerInterrupts;                         // The number of milliseconds elapsed during the current waiting period.
static volatile USB_ENDPOINT_INFO   *pCurrentEndpoint;                           // Pointer to the endpoint currently performing a transfer.
BYTE                                *pCurrentConfigurationDescriptor    = NULL;  // Pointer to the current configuration descriptor of the attached device.
BYTE                                *pDeviceDescriptor                  = NULL;  // Pointer to the Device Descriptor of the attached device.
static BYTE                         *pEP0Data                           = NULL;  // A data buffer for use by EP0.
static volatile WORD                 usbHostState;                               // State machine state of the attached device.
volatile WORD                 usbOverrideHostState;                       // Next state machine state, when set by interrupt processing.
#ifdef ENABLE_STATE_TRACE   // Debug trace support
    static WORD prevHostState;
#endif


2) Device list
A list of USB_DEVICE_INFO structure - device list - should be implemented.
- On device attach (at host port or over hub), a new member is added to the device list.
- On device detach, the target member is withdrawn from the list, and freed.
usbDeviceInfo variable is replaced with a pointer to a member of this list - current device.

3) Switch current device
Each middle-level function (without underscore) on usb_host.c takes deviceAddress parameter.
But they just check if the target device address matches to usbDeviceInfo.deviceAddress
Switch the current device pointer to the target device, here.

for example of USBHostWrite()

BYTE USBHostWrite( BYTE deviceAddress, BYTE endpoint, BYTE *data, DWORD size )
{
    USB_ENDPOINT_INFO *ep;

    // Find the required device
    if (deviceAddress != usbDeviceInfo.deviceAddress)
    {
        //
        // list search for the target comes here
        //
        if ( /* the target device is found on the device list */ )
            // switch the current device pointer to the target device
        else
            return USB_UNKNOWN_DEVICE;
    }



I suppose Microchip has a newer version of this file for their development.
Contact to them, and ask to them to get it in advance.

IMHO, pipe handle implementation makes the code simpler than the list search.

Tsuneo

#7
picture2x
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2010/09/07 23:40:46
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2010/09/23 07:21:37 (permalink)
0
Thanks for the reply sir.

I've done number 1 and 2 already and a part of 3.

I have found out that whenever the host does _USB_ParseConfigurationDescriptor, it seems that the endpoints are reset as described on the function.


  Remarks:

    * This function also automatically resets all endpoints (except
        endpoint 0) to DATA0, so _USB_ResetDATA0 does not have to be
        called.



This is what I observed when I analyze the endpoints that are being polled that it ommits the Status Change Endpoint of the hub so hopefully it is fixed.

Thanks sir for the comment. Any perceived problem left before my project is completed?
#8
Hartwig
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2010/05/19 03:57:54
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2011/04/06 15:23:52 (permalink)
0
-
post edited by Hartwig - 2011/04/07 15:48:59
#9
Hartwig
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2010/05/19 03:57:54
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2011/04/12 11:40:55 (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


I only get until Part (6), and checked that C_PORT_RESET flag drops. However, I don't get the device enumerated (7).
What do I need to do to in order to talk to the device, instead of the Hub?
It seems that only the Hub responds to the commands from the Host.
Anybody any ideas? Any help would be highly appreciated.
Hartwig
#10
Hartwig
Starting Member
  • Total Posts : 53
  • Reward points : 0
  • Joined: 2010/05/19 03:57:54
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2011/04/20 07:06:31 (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


I only get until Part (6), and checked that C_PORT_RESET flag drops. However, I don't get the device enumerated (7).
What do I need to do to in order to talk to the device, instead of the Hub?
It seems that only the Hub responds to the commands from the Host.
Anybody any ideas? Any help would be highly appreciated.
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
#11
mori.br
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2011/08/31 11:34:48
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2011/09/14 09:08:11 (permalink)
0

Hi everyone, first thank all for these usefull posts, after follow all these steps and i almost got it. In step 7, I always got the hub descriptor again even using another buffer to receive it. For tests purpouses i do not set usbHostState = STATE_ATTACHED|SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE;
I simply call:

x[0] = USB_SETUP_DEVICE_TO_HOST | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE;
x[1] = USB_REQUEST_GET_DESCRIPTOR;
x[2] = 0; // Index
x[3] = USB_DESCRIPTOR_DEVICE; // Type
x[4] = 0;
x[5] = 0;
x[6] = 0x12;
x[7] = 0;
_USB_InitControlRead( usbDeviceInfo.pEndpoint0, x, 8, buffer, 0x12 );

and read the response:

HOST: Initializing DETACHED state.
[>HOST: Starting settling delay.
HOST: Resetting the device.
HOST: Reset complete.
HOST: Reset complete.
HOST: Getting Device Descriptor size.
R> 80 06 00 01 00 00 08 00
HOST: Getting device descriptor.
R> 80 06 00 01 00 00 12 00
HOST: Validating VID and PID.
VID 0x05E3, PID 0x0608, CLS: 0x09
HUB DETECTED
HOST: Setting device address.
W> 00 05 02 00 00 00 00 00
HOST: Getting Config Descriptor size.
R> 80 06 00 02 00 00 08 00
HOST: Getting Config Descriptor.
R> 80 06 00 02 00 00 19 00
HOST: Parse Descriptor success
HOST: Set configuration.
W> 00 09 01 00 00 00 00 00
----------------------------------
HUB endpointIN  : 0x81
----------------------------------
HOST: Getting HUB Descriptor
R> A0 06 00 29 00 00 09 00


*** USB_DESCRIPTOR_HUB ****
bLength             0x09
bDescriptorType     0x29
bNbrPorts           0x04
wHubCharacteristics 0x00E9
bHubContrCurrent    0x64
bPwrOn2PwrGood      0x32
DeviceRemovable     0x00


HOST: Parse HUB Descriptor success
HOST: Enabling VBUS power on hub ports
W> 23 03 08 00 01 00 00 00
W> 23 03 08 00 02 00 00 00
W> 23 03 08 00 03 00 00 00
W> 23 03 08 00 04 00 00 00


STATUS CHANGE [10] PORT: 4


R> A3 00 00 00 04 00 04 00
PORT STATUS [01 01 01 00] PORT_CONNECTION PORT_POWER C_PORT_CONNECTION
W> 23 01 10 00 04 00 00 00


R> A3 00 00 00 04 00 04 00
PORT STATUS [01 01 00 00] PORT_CONNECTION PORT_POWER
 << 100ms after connection >>
W> 23 03 04 00 04 00 00 00


R> A3 00 00 00 04 00 04 00
PORT STATUS [11 01 00 00] PORT_CONNECTION PORT_RESET PORT_POWER
STATUS CHANGE [10] PORT: 4


R> A3 00 00 00 04 00 04 00
PORT STATUS [03 01 10 00] PORT_CONNECTION PORT_ENABLE PORT_POWER C_PORT_RESET
W> 23 01 14 00 04 00 00 00


R> A3 00 00 00 04 00 04 00
PORT STATUS [03 01 00 00] PORT_CONNECTION PORT_ENABLE PORT_POWER
========================================
usbHostState: 0x0400
R> 80 06 00 01 00 00 14 00
VID 0x05E3, PID 0x0608, CLS: 0x09 <-- ALWAYS HUB !!! 

What i doing wrong sad ? thanks in advance for any help
Mori



#12
mori.br
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2011/08/31 11:34:48
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2011/09/26 07:47:04 (permalink)
0
Problem solved
#13
MVR
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2012/08/10 16:30:05
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2012/08/23 06:13:34 (permalink)
0
Hi, we reached upto step 6 in enumerating hub. Can anyone help us what buffers need to be cleared?
We tried clearing pDescriptor and pEpData0. And not able to talk to device, always hub is the one responding.
Please help.

Thanks
Mvr
#14
MVR
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2012/08/10 16:30:05
  • Location: 0
  • Status: offline
Re:Problem Enumerating Hub-Attached Devices 2012/08/25 19:55:17 (permalink)
0
Hi Tsuneo,
 
I followed your steps posted in http://www.microchip.com/.rums/m523103-print.aspx. This was very useful Thank you very much! I am able to proceed through step 6. I am having a hardtime, as i am new to this USB and HUB driver side and fighting for last few weeks to solve this.
 
I desperately need your help and here are my lessons learnt - 
1) In my case I always getting the hub responses but not the device attached to the port.
2) Also as you mentioned in step 5{Interrupt IN) , we are missing to capture the interrupt sent by device after reset but we are able to proceed to next step by going through the port status command.
 
Custom LOGS  -

***** USB Custom Demo App Initialized *****
HOST: Initializing DETACHED state.
Event handled - event = 105
Generic demo device VBUS REQUEST DONE - event
HOST: Starting settling delay.
HOST: Resetting the device.
HOST: Reset complete.
HOST: Reset complete.
HOST: Getting Device Descriptor size.
 HubDeviceFound 0
 HOST: Getting device descriptor.
 bMaxPacketSize0 = 0x40 , idVendor = 0x1A40 , idProduct = 0x11
HOST: Getting HUB device descriptor.
 Device Descriptor bLength = 0x9 , bDescriptorType = 0x29 , nPorts = 0x4,
<<< Followed your steps in the forum by creating state HUB and enumerating it, i found that i am using low speed device >>>
SUBSUBSTATE_HUB_SET_PORT_FEATURE_POWER COMPLETE
 SUBSUBSTATE_HUB_WAIT_FOR_PORT_STATUS done port 1 = 1 3 1 0
 SUBSUBSTATE_HUB_WAIT_FOR_CLEAR_PORT_FEATURE complete
 SUBSUBSTATE_HUB_WAIT_FOR_PORT_STATUS done port 1 = 1 3 0 0
 SUBSUBSTATE_HUB_WAIT_FOR_SET_PORT_FEATURE_RESET complete
 SUBSUBSTATE_HUB_WAIT_FOR_PORT_STATUS done port 1 = 3 3 10 0
 SUBSUBSTATE_HUB_WAIT_FOR_CLEAR_PORT_FEATURE complete
 SUBSUBSTATE_HUB_WAIT_FOR_PORT_STATUS done port 1 = 3 3 0 0
HOST: Getting device descriptor.
                            // Set up and send GET DEVICE DESCRIPTOR
                            pEP0Data[0] = USB_SETUP_DEVICE_TO_HOST | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_DEVICE;
                            pEP0Data[1] = USB_REQUEST_GET_DESCRIPTOR;
                            pEP0Data[2] = 0; // Index
                            pEP0Data[3] = USB_DESCRIPTOR_DEVICE; // Type
                            pEP0Data[4] = 0;
                            pEP0Data[5] = 0;
                                pEP0Data[6] = 20; // Assuming it would be less than 20 bytes
                            pEP0Data[7] = 0;
 
                                    if (pDeviceDescriptor != NULL)
                                    {
                                        freez( pDeviceDescriptor );
                                        if ((pDeviceDescriptor = (BYTE *)malloc( 100 )) == NULL)
                                        {
                                            // We cannot continue.  Freeze until the device is removed.
                                            _USB_SetErrorCode( USB_HOLDING_OUT_OF_MEMORY );
                                            _USB_SetHoldState();
                                            break;
                                        }
                                    }
                                    //usbDeviceInfo.deviceAddress = 0x04;
                                    *pDeviceDescriptor = 20;
 
                            _USB_InitControlRead( usbDeviceInfo.pEndpoint0, pEP0Data, 8, pDeviceDescriptor, *pDeviceDescriptor  );
 

 bMaxPacketSize0 = 0x40 , idVendor = 0x1A40 , idProduct = 0x11  <----------------- Still pointing to HUB, i think missed the device interrupt
We cleared the pEP0Data and pDescriptor buffers before sending "get_device_descriptor" request to the device. I am not sure whether i need to clear anyother buffers.
 
Thanks
mvr
#15
Jump to:
© 2019 APG vNext Commercial Version 4.5