配置描述符之后紧接着就是接口描述符,接口描述符指明了接口的类型,对应的端点的数量。以下是定义:
bLength:标准的接口描述符的长度是9个字节
bDescriptorType:表示描述符的类型,接口描述符对应的值是4
bInterfaceNumber:接口的编号,从0开始
bAlternateSetting:接口的备用编号,一般使用0
bNumEndpoints:表示该接口使用的端点数,当为0时,表示使用0端点
bInterfaceClass:接口使用的类
bInterfaceSubClass:接口使用的子类
bInterfaceProtocol:接口使用类的协议
iInterface:接口字符串的索引值,为0时表示没有接口字符串
那我们看看cypress 的 uvc 的接口描述符
/* Standard Video Streaming Interface Descriptor (Interface 1, Alternate Setting 0) */
0x09, /* Descriptor size */
0x04, /* Interface descriptor type */
0x01, /* Interface number: 1 */
0x00, /* Alternate setting number: 0 */
0x01, /* Number of end points: 1 Bulk endopoint*/
0x0E, /* Interface class : CC_VIDEO */
0x02, /* Interface sub class : SC_VIDEOSTREAMING */
0x00, /* Interface protocol code : PC_PROTOCOL_UNDEFINED */
0x00, /* Interface descriptor string index */
接口的编号是1,当然必须从0开始,endpoint是1个,interface class 是0x0E,sub class 是0x02,protocol是0x00
此定义在http://www.usb.org/developers/defined_class可以找到,关于subclass以及protocol在video类中定义。