usb_enum.rst 1.8 KB

12345678910111213141516171819202122
  1. USB Enumeration
  2. =========================================
  3. After understanding USB device requests, we can learn about the entire enumeration process of USB devices and see how devices like serial ports, mice, and USB drives are enumerated. During enumeration, the host will send device requests to obtain relevant information (i.e., descriptors). For specific requests sent, refer to the diagram below.
  4. .. figure:: img/usb_enum.png
  5. - First, connect the device to the USB cable, then plug it into the computer
  6. - After the device is plugged in, it powers up and enters a powered state
  7. - The host detects device insertion through D+/D-
  8. - Reset the device
  9. - Host sends **Get Device Descriptor Request**
  10. - Optional reset operation
  11. - Host sends **Set Device Address Request**
  12. - Host sends **Get Configuration Descriptor Request**, may be obtained multiple times, which doesn't matter
  13. - Host sends **Get String Descriptor Request**, normally obtains 3 strings, and continues to obtain specified strings if they are specified in subsequent descriptors
  14. - Host sends **Get Device Qualifier Descriptor Request**, used to obtain requests when the device operates at other speeds. If the device can only work in full-speed mode, it must reply with stall, and the protocol stack will definitely print this request to inform you that the device does not support this command.
  15. - Host sends **Set Configuration Request**, configures device endpoints, usually based on the configuration in endpoint descriptors.
  16. - Standard device requests end here
  17. - Host loads corresponding supported class drivers based on interface descriptors. If the host doesn't support them, it will prompt that no driver is found for the device
  18. - After loading is complete, begins executing related requests for that class
  19. - Finally performs class data flow transmission