USB descriptor【转】

转自:http://blog.csdn.net/jacobywu/article/details/8861882

  1. 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));  
时间: 2024-07-29 09:44:33

USB descriptor【转】的相关文章

USB组合设备 Interface Association Descriptor (IAD)

Communication Device Class,简称CDCUSB Compound Device,USB复合设备USB Composite Device,USB组合设备 摘要USB复合设备 Compound Device内嵌Hub和多个Function,每个Function都相当于一个独立的USB外设,有自己的PID/VID.USB组合设备Composite Device内只有一个Function,只有一套PID/VID,通过将不同的interface定义为不同的类来实现多个功能的组合.

Using a USB host controller security extension for controlling changes in and auditing USB topology

Protecting computer systems from attacks that attempt to change USB topology and for ensuring that the system's information regarding USB topology is accurate is disclosed. A software model is defined that, together with secure USB hardware, provides

【转】簡單講講 USB Human Interface Device

原地址http://213style.blogspot.com/2013/09/usb-human-interface-device.html 恩,發本文的原因是看到了以前畢業的朋友在旁邊的對話框問了一些問題,我想這些問題 不是三言兩語可以解釋完畢,但是我也不想又太細究 HID 內部描述表格的解說與視窗上 HID APIs 家族詳細使用方法,主要以偏向解決問題與實作面上的一些重點,希望可以有些 許幫助,因為詳細的文獻找 USB Complete: The Developer's Guide fo

qq2440启动linux后插入u盘出现usb 1-1: device descriptor read/64, error -110,usb 1-1: device not accepting address 8, error -110

上位机:ubuntu14.04 64bit 下位机:qq2440 交叉编译器:arm-linux-gcc 3.4.1 下位机使用的linux内核版本:kernel2.6.13 1.插入u盘时错误信息如下: [[email protected] /home]# usb 1-1: new full speed USB device using s3c2410-ohci and address 6usb 1-1: device descriptor read/64, error -110usb 1-1

遍历 USB devcie,读取设备描述符 device descriptor【转】

转自:http://blog.csdn.net/flyyyri/article/details/5480347 理论:    对于USB接口的设备,现在越来越多了.本篇我们就通过获取一个USB扫描仪设备中的序列号,来介绍如何获取usb设备的一些硬件信息.对于usb设备都是采用HCD0,HCD1,HCD2,HCD3等符号描述的.如下图: 因此,有了这个名字,我们就可以使用CreateFile来打开usb设备.然后使用DeviceIoControl函数与usb设备通讯了.HCD是host contr

USB HID Report Descriptor 报告描述符详解

Report descriptors are composed of pieces of information. Each piece of information is called an Item.报告描述符由一些数据片组成.这些数据片被叫做Item.All items have a one-byte prefix that contains the item tag, item type, and item size. 每一个Item都包含一个字节的前缀,这个前缀中包含了三个信息--it

(USB HID) Report Descriptor 理解

在這理整理一下基本 Report Descriptor 對於入門基礎的了解. 在很多文件.Blog都有提到HID report 總共分為3種 : Input.Output.Feature reports. 在這些 In/Out 方向提的是Host的方向(PC),則 Feature是雙向傳輸的. USB的網站找得到一隻小工具主要是幫忙編輯USB HID Report Descriptor用的 如果少了這隻Tool,做為一個USB HID開發的工程師就必須去HID Usage Tables查表填對應

USB 描述符

标准的USB设备有5种USB描述符:设备描述符,配置描述符,字符串描述符,接口描述符,端点描述符. 1 // Standard Device Descriptor 2 typedef struct 3 { 4 u8 bLength; 5 u8 bDescriptorType; 6 u16 bcdUSB; 7 u8 bDeviceClass; 8 u8 bDeviceSubClass; 9 u8 bDeviceProtocol; 10 u8 bMaxPacketSize0; 11 u16 idVe

usb库文件usb_desc.c分析

参考<圈圈教你玩USB> usb协议中使用的是小端结构,所以实际数据在传输时是低字节在先的. 设备描述符的实现: 已知每个设备都必须有且仅有一个设备描述符,它的结构在USB协议中有详细的定义.               偏移量                             域                  大小/字节                          说 明                        0 bLength 1 该描述符的长度(18字节) 1 b