USB枚举过程图示分析

本文描述了通过USB Tracker追踪USB设备的Windows XP上的枚举过程,在读该篇文章之前首先阅读USB枚举过程能够对USB枚举过程中的各个概念建立更准确的理解。另外Windows系统上USB枚举的详细过程可以参考“How does USB stack enumerate a device?”(CSDN禁止插入该链接,google吧)

下面图1是USB枚举过程的流程图,图2是通过USBTracker抓取的USB枚举过程中的主要交互数据包。


图1 USB枚举过程

图2 USB tracker数据包

The enumeration interrupt procedure will last until the host finally set a appropriate configuration for the device.

•Step1: Get device descriptor  through default address 0 , now the host does not know the descriptor length, so 64 bytes in length is set by default. For the host, the most significant information is the descriptor length returned at the 7th byte. So the host will only read the first 8 bytes. After this step, the host may ask the hub to reset the device again to make sure that the device being into a certain state.

Step2: Set address, address 3 is allocated to our device this time

Step3: Get device descriptor again through settled address. After the first get descriptor request  on address 0, the host has retrieved the descriptor length. So this time the device the actual length is configured. After this step, the host will retrieve the configuration num.

•Step4: Get configuration descriptor, 9 bytes length, the host will retrieve the total length of this configuration descriptor, including all interface and endpoint descriptor(s) and exist string descriptor.

•Step5: Get configuration descriptor  again, this time the device will return all interface and endpoint descriptors belong to this configurationIn detail(1) .

Step5: Get configuration descriptor in detail(2). Step4-5 will be carried multiple  times if there are multiple configurations.

•Step6: Get string Descriptor.(String lang IDs)

•Step7: Get string Descriptor. The string descriptor may including Language ID, Vendor ID, product index, etc.  (String iProduct)

       Note:Now,on the basis of responds, the host install the appropriate driver, choose driver according to VID and PID. Within the involvment of device driver, the same process will be carried again for accurate device control purpose .

•Step8: Get Descriptor(device, configuration) again in order to choose appropriate configuration  based on the information acquired before, and the selected configure will be sent to the device next.

•Step9: Set Configuration (1), the device is successfully configured and it can transfer data with the client software.  According to the response of Device and Configuration Descriptor, the host can choose the configuration it support and load appropriate driver.

•Step 10: Get string Descriptor (all iInterface descriptions supported by the selected configuration)

•Step11: Get Status (Device)

•Step12: Get Descriptor (String iInterface), return the description of selected interface

After the success enumeration, the Device will interact with the host or suspended for power saving

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值