This video shows how does USB device discovery work. The communication between a USB device and a target device shows us that there is a multitude of variables and communications between the two, where the system discovers both the speed of the connected USB and also the different negotiations that exist between the two. Now an interesting video from Ben Eater shows us what happens when you connect a USB device to a PC.
How does USB device discovery work?
When you connect a device, first it will trigger a prior negotiation or communication. The first of these communications are the signals from the device that will let you know if it is a high or low-speed device.
When a device is connected to the USB system, it is assigned a number called an “address”. The address is used exclusively by that device while it is connected. This address can change each time the device is connected.
Moreover, in addition to this address, this device also has several endpoints, a collection of sources and destinations between the various communications between the host and the device.
All standard requests are transmitted via control transfers to endpoint 0. A control transfer starts with an establishment transaction carrying 8 bytes. These 8 bytes define the host request.
During USB communication, data is transmitted as packets. Initially, all packets are sent from the host through the root hub. Some of those packets cause a device to send some packets in response.
Communication within the USB is based on a series of data pipes, logical channels within the data stream. You could say they are a connection from the host controller to a logical entity within a device, which acts as the endpoint.