Configuration Descriptor
整個Configuration 分成4大部分 :
- configuration
- interface,
- class or vendor specific( 如 HID, Audio)
- endpoint
以一个usb audio 的设备configuration descriptor来举例:
typedef struct
{
configuration_descriptor cd; // Configuration descriptor
interface_descriptor id0; // Audio control interface
audio_header_descriptor ahd; // Audio control header
input_terminal_descriptor itd; // Audio input terminal
feature_unit_descriptor fud; // Audio feature unit
output_terminal_descriptor otd; // Audio output terminal
interface_descriptor id1_0; // Audio zero-bandwidth interface
interface_descriptor id1_1; // Audio streaming interface
stream_interface_descriptor sid; // Audio stream descriptor
typeI_format_descriptor tfd; // Audio format descriptor
stream_endpoint_descriptor sed; // Streaming endpoint descriptor
audio_endpoint_descriptor aed; // Audio endpoint descriptor
interface_descriptor id2; // HID interface descriptor
hid_descriptor hd; // HID descriptor
endpoint_descriptor ed1; // GET_REPORT input endpoint
endpoint_descriptor ed2; // SET_REPORT output endpoint
} complete_configuration; // End of complete_configuration
configuration_descriptor:
{ // Standard configuration descriptor
0x09, // bLength (9)
0x02, // bDescriptorType (CONFIGURATION)
0x9100, // wTotallength (145)
0x03, // bNumInterfaces (3)
0x01, // bConfigurationValue (1)
0x00, // iConfiguration (none)
0x80, // bmAttributes (bus-powered)
0x32, // bMaxPower (100 mA)
},
有3个interface,configuration No is 1, 没有字符串描述
第一个interface 是 interface_descriptor id0; // Audio control interface
{ // Audio control interface0x09, // bLength (9)0x04, // bDescriptorType (INTERFACE)0x00, // bInterfaceNumber (0)0x00, // bAlternateSetting (none)0x00, // bNumEndpoints (none)0x01, // bInterfaceClass (AUDIO)0x01, // bInterfaceSubClass (AUDIO_CONTROL)0x00, // bInterfaceProtocol (none)0x00 // iInterface (none)
},
interface 序号是0, endpoints 个数为0, AUDIO CLASS, AUDIO_CONTROL
包含一个Header, Input_terminal further unit,OUTPUT_TERMINAL
因为interface是audio 类,后边跟类描述符
{ // Audio class-specific interface header
0x09, // bLength (9)
0x24, // bDescriptorType (CS_INTERFACE)
0x01, // bDescriptorSubtype (HEADER)
0x0001, // bcdADC (1.0)
0x2B00, // wTotalLength (43)
0x01, // bInCollection (1 streaming interface)
0x01 // baInterfaceNr (interface 1 is stream)
},
{ // Audio class-specific input terminal
0x0C, // bLength (12)
0x24, // bDescriptorType (CS_INTERFACE)
0x02, // bDescriptorSubtype (INPUT_TERMINAL)
0x01, // bTerminalID (1)
0x1007, // wTerminalType (radio receiver)
0x00, // bAssocTerminal (none)
0x02, // bNrChannels (2)
0x0300, // wChannelConfig (left, right)
0x00, // iChannelNames (none)
0x00 // iTerminal (none)
},
{ // Audio class-specific feature unit
0x0D, // bLength (13)
0x24, // bDescriptorType (CS_INTERFACE)
0x06, // bDescriptorSubtype (FEATURE_UNIT)
0x02, // bUnitID (2)
0x01, // bSourceID (input terminal 1)
0x02, // bControlSize (2 bytes)
0x0100, // Master controls
0x0000, // Channel 0 controls
0x0000, // Channel 1 controls
0x00 // iFeature (none)
},
{ // Audio class-specific output terminal
0x09, // bLength (9)
0x24, // bDescriptorType (CS_INTERFACE)
0x03, // bDescriptorSubtype (OUTPUT_TERMINAL)
0x03, // bTerminalID (3)
0x0101, // wTerminalType (USB streaming)
0x00, // bAssocTerminal (none)
0x02, // bSourceID (feature unit 2)
0x00 // iTerminal (none)
},
第二个interface { // Audio zero-bandwidth interface
0x09, // bLength (9)
0x04, // bDescriptorType (INTERFACE)
0x01, // bInterfaceNumber (1)
0x00, // bAlternateSetting (0)
0x00, // bNumEndpoints (0)
0x01, // bInterfaceClass (AUDIO)
0x02, // bInterfaceSubClass (AUDIO_STREAMING)
0x00, // bInterfaceProtocol (none)
0x00 // iInterface (none)
},
第三个interface
{ // Audio streaming interface (alternate)
0x09, // bLength (9)
0x04, // bDescriptorType (INTERFACE)
0x01, // bInterfaceNumber (1)
0x01, // bAlternateSetting (1)
0x01, // bNumEndpoints (1)
0x01, // bInterfaceClass (AUDIO)
0x02, // bInterfaceSubClass (AUDIO_STREAMING)
0x00, // bInterfaceProtocol (none)
0x00 // iInterface (none)
},
{ // Audio class-specific stream interface
0x07, // bLength (7)
0x24, // bDescriptorType (CS_INTERFACE)
0x01, // bDescriptorSubtype (AS_GENERAL)
0x03, // bTerminalLink (terminal 3)
0x00, // bDelay (none)
0x0100 // wFormatTag (PCM format)
},
{ // Audio class-specific type I format
0x0B, // bLength (11)
0x24, // bDescriptorType (CS_INTERFACE)
0x02, // bDescriptorSubtype (FORMAT_TYPE)
0x01, // bFormatType (TYPE_I)
0x02, // bNrChannels (2)
0x02, // bSubFrameSize (2)
// The next field should be 10, but 16 works with more standard software
0x10, // bBitResolution (16)
0x01, // bSamFreqType (1 sampling frequency)
0x80, // 48,000 Hz (byte 0)
0xBB, // 48,000 Hz (byte 1)
0x00 // 48,000 Hz (byte 2)
},
{ // Audio streaming isochronous endpoint
0x09, // bLength (9)
0x05, // bDescriptorType (ENDPOINT)
0x83, // bEndpointAddress (EP3 in)
0x05, // bmAttributes (asynchronous)
0x0002, // wMaxPacketSize (512)
0x01, // bInterval (1 millisecond)
0x00, // bRefresh (0)
0x00 // bSynchAddress (no synchronization)
},
{ // Audio isochronous endpoint
0x07, // bLength (7)
0x25, // bDescriptorType (CS_ENDPOINT)
0x01, // bDescriptorSubtype (EP_GENERAL)
0x00, // bmAttributes (none)
0x02, // bLockDelayUnits (PCM samples)
0x0000 // wLockDelay (0)
},
HID interface 还有endpoints
{ // HID interface
0x09, // bLength (9)
0x04, // bDescriptorType (INTERFACE)
0x02, // bInterfaceNumber (2)
0x00, // bAlternateSetting (0)
0x02, // bNumEndpoints (2)
0x03, // bInterfaceClass (HID)
0x00, // bInterfaceSubClass (none)
0x00, // bInterfaceProtocol (none)
0x00 // iInterface (none)
},
{ // HID descriptor
0x09, // bLength (9)
0x21, // bDescriptorType (HID_DESCRIPTOR)
0x1101, // bcdHID (1.11)
0x00, // bCountryCode (none)
0x01, // bNumDescriptors (1 class descriptor)
0x22, // bClassDescriptorType (report descr.)
LE(HID_REPORT_SIZE) // wDescriptorLength (203)
},
{ // HID interrupt in endpoint
0x07, // bLength (7)
0x05, // bDescriptorType (ENDPOINT)
0x81, // bEndpointAddress (EP1 in)
0x03, // bmAttributes (interrupt)
0x4000, // wMaxPacketSize (64)
0x0A // bInterval (10 milliseconds)
},
{ // HID interrupt out endpoint
0x07, // bLength (7)
0x05, // bDescriptorType (ENDPOINT)
0x02, // bEndpointAddress (EP2 out)
0x03, // bmAttributes (interrupt)
0x4000, // wMaxPacketSize (64)
0x01 // bInterval (1 millisecond)
}
HID report descriptor 一般独立于 configuration之外
HidReportDesc
{
0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xA1, 0x01, // COLLECTION (Application)
0xC0 // END_COLLECTION
};
Configuration Descriptor相关推荐
- 【USB笔记】配置描述符Configuration Descriptor
USB笔记 配置描述符(Configuration Descriptor) 配置描述符(Configuration Descriptor)说明了一个特定配置的相关信息.取得设备描述符(Device D ...
- 2. UFS2.1 —— Descriptor描述符
描述符 由Query Request UPIU来访问描述符. Descriptor length:2 ~ 255B (2B是一个空的描述符) 描述符是一页或一块参数来描述设备信息.大部分的描述符是On ...
- Usb Composite Device (audio+hid) Descriptor
近期开发USB Composite Device 撰写的USB 描述符 ,支持 USB speaker + USB Mic,同时支持USB HID 自定义设备.可以作为 开发设备的参考.(此描述符已经 ...
- 【USB笔记】端点描述符Endpoint Descriptor
USB笔记 端点描述符 (Endpoint Descriptor) 端点描述符 (Endpoint Descriptor)描述了USB规范定义的端点信息,包含有端点的带宽等信息.每一个端点都有自己的端 ...
- 【USB笔记】接口描述符Interface Descriptor
USB笔记 接口描述符 (Interface Descriptor) 接口描述符(Interface Descriptor)描述了配置中一个特定的接口.配置提供了一个或多个接口,每个接口都含有类(Cl ...
- 【USB笔记】 设备描述符Device Descriptor
USB笔记 设备描述符(Device Descriptor) 设备描述符(Device Descriptor)说明了USB设备的通用信息,包含应用到全部设备和所有设备配置的信息.USB设备只有一个设备 ...
- Tomcat服务器端口的配置
一.Tomcat服务器端口的配置 Tomcat的所有配置都放在conf文件夹之中,里面的server.xml文件是配置的核心文件. 如果想修改Tomcat服务器的启动端口,则可以在server.xml ...
- USB开发基础:USB命令(请求)和USB描述符
一.USB命令 在USB规范里,对命令一词提供的单词为"Request",但这里为了更好的理解主机与设备之间的主从关系,将它定义成"命令". 所有的USB设备都 ...
- 2.7 usb摄像头之usb摄像头描述符打印
学习目标:参考lsusb源码,打印USB摄像头的设备描述符.配置描述符.接口联合描述符.端点描述符: 一.lsusb命令和源码 使用命令lsusb可以看看设备的id,并执行 # lsusb -v -d ...
最新文章
- 为11.2.0.2 Grid Infrastructure添加节点
- 矩阵管理——和visitor模式没有本质区别,都是为了避免资源重复
- python标准库和第三方库_python常用标准库及三方库
- oracle创建用户需要什么权限,Oracle 创建普通用户,并赋予权限
- Docker04-镜像
- Go1.18 新特性:高效复制,strings, bytes 库新增 Clone 功能
- 什么是大数据平台和大数据
- java怎么格式化日期_java 时间格式化各种方法
- ACCESS品牌管理集团为你甄选生活好物 VTN会员商城与品质的故事
- Xcode6 中URL Scheme的具体使用
- MYSQL查询优化一
- 时间序列模型SCINet(代码解析)
- PAT 1157 Anniversary
- Java 遍历 Redis Hash key中所有数据
- 【JavaWeb】JavaWeb与JavaWeb技术栈
- 为QNX系统增加定制命令方法
- C语言英文背单词软件,C语言背单词程序
- 《Java核心技术卷一》读书笔记
- 亚马逊、Facebook在印度遭遇的最大阻力竟是中国!
- Java+MySQL 基于ssm的公司员工人事工资管理系统#毕业设计
热门文章
- mui多页面情况下返回主页
- Normal Matrix推导 (法向量变换矩阵)
- html view 居中,HTML--元素居中各种处理方法
- 微信小程序插件使用和更新
- python adb模块,python + adb 实现控制手机,,主要步骤:1、USB
- 【BDTC2016】D-uni FounderCEO查理:数据敏捷性,数据时代的云架构
- JavaScript - 截取指定字符串前面或者后面的所有内容(截取某个字符后面/前面的字符串)
- Mac安装chromedriver
- rk3288上ap6212自定义wifi的mac地址
- 创业方向:O2O及移动社交 from 沈博阳