Electrical – How do USB hubs work when same device is connected

usbusb hub

I was reading on how USB hubs work and since there is only 1 master, master sends a command to an endpoint. However, how does a USB hub work when there are 2 same devices plugged into a USB hub? How does the device know which is being addressed?

Best Answer

USB has a process called “enumeration” where each device, including hubs, is assigned an 7-bit number used to identify it to the host. When a hub is attached, it is enumerated and then each device downstream is enumerated.

This is the reason that no more than 127 devices may be attached at any time.

Therefore, each of your identical devices receives a different number. Which one gets what number depends on the order they are enumerated.

If you need to programmatically tell the difference, you must use the devices’ serial numbers, if they have them.

Related Topic