1. ACCORDING TO THEORY OF USB WE CONNECT 127 DEVICE TO ONE USB PORT THROUGH HUBS
NOW THE QUESTION IS THAT HOW THE 2ND DEVICE SHOULD BE IDENTIFYED BY HOST
BCAUSE D+/D- LINE IS ALREADY PULLED HIGH (HIGH SPEED/LOW SPEED USB) WITHEN ENUMRATION WITH 1ST DEVICE,
THEN HOW HOST CAN IDETIFY THE 2 ND DEVICE AS D+/D- LINE IS ALREADY HIGH
Hub is not just a wired connection of ports. Each downstream port is equipped a bi-directional buffer for D+/D-, to isolate each port. Also, hub is a USB device to co-operate with host.
1) Just when a device is plugged in to a hub port, the bi-directional buffer is disabled. The device is isolated from the bus.
2) Hub detects D+ (or D-) voltage change on the port. It notifies the change to the host over hub's interrupt IN endpoint. (or host polls status change periodically using Get_Port_Status request to the hub, depending on the host stack implementation.) Host confirms the port connection by Get_Port_Status request (C_PORT_CONNECTION), and drops the flag using Clear_Port_Feature(C_PORT_CONNECTION)
3) Host waits for 100 ms or more, to give the device connection delay, defined in the USB 2.0 spec (Figure 7-29, delta T3).
4) Host sends Set_Port_Feature( PORT_RESET ) to the hub for the target port. The hub starts bus reset on the port. With this bus reset, the device sets its address to 0.
5) At the end of bus reset period, the hub enables the bi-directional buffer of the port. The device connects to the bus at this point. Hub notifies the end of bus reset over the hub's interrupt IN endpoint, or host polls it using repeated Get_Port_Status request (C_PORT_RESET). Host drops this flag by Clear_Port_Feature( C_PORT_RESET )
6) Host continues enumeration of the device (Get_Descriptor( DEVICE ), Set_Address, ...), as if the device directly connects to the host port.
Above sequence is based on MacOS X. Windows sequence is more unrefined.
post edited by chinzei - 2010/06/28 16:10:23