您现在的位置是:主页 > USB2.0规范 >
USB 接口描述符
发布时间:2022-12-31 01:56:33所属栏目:USB2.0规范 已帮助人编辑作者:【USB接口百科】
接口描述符一般是按设备的运行状态分类,这样设备可以在不同的接口中切换来实现设备运行状态的切换,如在设备在运行状态下使用正常的接口描述符,在停止状态下使用该接口描述符的备用接口描述符。
接口描述符的定义:struct _INTERFACE_DESCRIPTOR_STRUCT
{
BYTE bLength; //设备描述符的字节数大小,为0x09
BYTE bDescriptorType; //描述符类型编号,为0x04
BYTE bInterfaceNumber; //接口的编号
BYTE bAlternateSetting;//备用的接口描述符编号
BYTE bNumEndpoints; //该接口使用端点数,不包括端点0
BYTE bInterfaceClass; //接口类型
BYTE bInterfaceSubClass;//接口子类型
BYTE bInterfaceProtocol;//接口所遵循的协议
BYTE iInterface; //描述该接口的字符串索引值
}INTERFACE_DESCRIPTOR_STRUCT
接口描述符的字段:
bLength : 描述符大小.固定为0x09.bDescriptorType : 接口描述符类型.固定为0x04.bInterfaceNumber: 该接口的编号.bAlternateSetting : 用于为上一个字段选择可供替换的位置.即备用的接口描述符标号.bNumEndpoint : 使用的端点数目.端点0除外.bInterfaceClass : 类型代码(由USB分配).bInterfaceSubClass : 子类型代码(由USB分配).bInterfaceProtocol : 协议代码(由USB分配).iInterface : 字符串描述符的索引
Windbg显示接口描述符2: kd> dt _USBD_INTERFACE_INFORMATION 0xffffdb8d`cf4e3c58
xxx!_USBD_INTERFACE_INFORMATION
+0x000 Length : 0x48
+0x002 InterfaceNumber : 0 ''
+0x003 AlternateSetting : 0x1 ''
+0x004 Class : 0xff ''
+0x005 SubClass : 0xf0 ''
+0x006 Protocol : 0x1 ''
+0x007 Reserved : 0 ''
+0x008 InterfaceHandle : 0xffffdb8d`c2d2f4f0 Void
+0x010 NumberOfPipes : 2
+0x018 Pipes : [1] _USBD_PIPE_INFORMATION
某USB移动硬盘的接口描述符
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08 -> This is a Mass Storage USB Device Interface Class
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x00
...
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x01 //接口0的备份接口描述符
bNumEndpoints: 0x04
bInterfaceClass: 0x08 -> This is a Mass Storage USB Device Interface Class
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x62
iInterface: 0x00
以上就是USB接口百科为您提供USB 接口描述符的解读,本文章链接: http://www.usb-hub.cn/usb20gf/42285.html 欢迎分享转载,更多婚礼相关资讯请前往USB2.0规范
上一篇:USB 配置描述符
下一篇:USB 接口关联描述符