USB descriptor

struct usb_device_descriptor {
	__u8  bLength;//设备描述符的字节数大小,为0x12 
	__u8  bDescriptorType;//描述符类型编号,为0x01 

	__le16 bcdUSB;//USB版本号 
	__u8  bDeviceClass;//USB分配的设备类代码,0x01~0xfe为标准设备类,0xff为厂商自定义类型 
	
	//0x00不是在设备描述符中定义的,如HID 
	__u8  bDeviceSubClass;//usb分配的子类代码,同上,值由USB规定和分配的
	__u8  bDeviceProtocol;//USB分配的设备协议代码,同上 
	__u8  bMaxPacketSize0;//端点0的最大包的大小 
	__le16 idVendor;//厂商编号 
	__le16 idProduct;//产品编号 
	__le16 bcdDevice;//设备出厂编号
	__u8  iManufacturer;//描述厂商字符串的索引 
	__u8  iProduct;//描述产品字符串的索引
	__u8  iSerialNumber;//描述设备序列号字符串的索引 
	__u8  bNumConfigurations;//可能的配置数量
} __attribute__ ((packed));


struct usb_config_descriptor {
	__u8  bLength;//设备描述符的字节数大小,为0x12 
	__u8  bDescriptorType;//描述符类型编号,为0x01 
	__le16 wTotalLength;//配置所返回的所有数量的大小 

	__u8  bNumInterfaces;//此配置所支持的接口数量 
	__u8  bConfigurationValue;//Set_Configuration命令需要的参数值 
	__u8  iConfiguration;//描述该配置的字符串的索引值 
	__u8  bmAttributes;//供电模式的选择
	__u8  bMaxPower;//设备从总线提取的最大电流 
} __attribute__ ((packed));

struct usb_interface_descriptor {
	__u8  bLength;//设备描述符的字节数大小,为0x12
	__u8  bDescriptorType;//描述符类型编号,为0x01 

	__u8  bInterfaceNumber;//接口的编号 
	__u8  bAlternateSetting;//备用的接口描述符编号 
	__u8  bNumEndpoints;//该接口使用端点数,不包括端点0
	__u8  bInterfaceClass;//接口类型 
	__u8  bInterfaceSubClass;//接口子类型
	__u8  bInterfaceProtocol;//接口所遵循的协议 
	__u8  iInterface;//描述该接口的字符串索引值
} __attribute__ ((packed));


struct usb_endpoint_descriptor {
	__u8  bLength;//设备描述符的字节数大小,为0x12 
	__u8  bDescriptorType;//描述符类型编号,为0x01 

	__u8  bEndpointAddress;//端点地址及输入输出属性 
	__u8  bmAttributes;//端点的传输类型属性 
	__le16 wMaxPacketSize;//端点收、发的最大包的大小
	__u8  bInterval;//主机查询端点的时间间隔

	/* NOTE:  these two are _only_ in audio endpoints. */
	/* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
	__u8  bRefresh;
	__u8  bSynchAddress;
} __attribute__ ((packed));

struct usb_string_descriptor {
	__u8  bLength;//设备描述符的字节数大小,为0x12 
	__u8  bDescriptorType;//描述符类型编号,为0x01 

	__le16 wData[1];		/* UTF-16LE encoded */
} __attribute__ ((packed));


 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值