UAC设备实例分析
+ -

华为UAC耳机的工作过程数据分析

2021-02-08 2068 0

华为UAC耳机工作时,首先需要打开设备,然后读取数据,播放过程后,需要关闭设备。这里我们使用BusHound抓包(省略掉重复的数据包:

由于这些特定类请求是发给UAC音频控制终端/实体或接口的,所以我们先回顾一下UAC音频控制单元的一些ID,然后对照其选择子进行分析。

UAC音频控制接口头描述符 ID 描述
音频控制输入终端描述符 1 SB Streaming
音频控制特效单元描述符 2 Audio Control Feature Unit
音频控制输出终端描述符 3 HeadPhone
音频控制输入终端描述符 4 USB Streaming
音频控制输出终端描述符 5 MicroPhone

UAC的音频流接口2用于耳机,其中转换接口=0时无数据端点即表示无数据流,转换接口=1表示每通道2字节的数据长度,转换接口=3表示每通道3字节的数据长度。

接口 描述
接口ID=2,转换接口=0 无数据流
接口ID=2,转换接口=1 16位2通道
接口ID=2,转换接口=2 24位2通道

系统默认为48000HZ采样率,16位2通道数据格式。以下以此为例进行分析:

华为UAC耳机打开

Length    Phase  Data                                         
--------  -----  -----------------------------  --------------        
          CTL    01 0b 01 00  02 00 00 00       SET INTERFACE 
          CTL    22 01 00 01  03 00 03 00       SET CUR       
       3  OUT    80 bb 00

可以看到:

 01 0b 01 00  02 00 00 00

使用特定类请求选择接口2,其转换接口=1
然后向端点3(数据流端口地址)发送SET_CUR,设置采样率SAMPLING_FREQ_CONTROL(0x0100)选择子的请求,数据长度为3,附带的数据为 80 bb 00,表示采样率为48000。

     CTL    22 01 00 01  03 00 03 00       SET CUR    
  3  OUT    80 bb 00

UAC耳机关闭

关闭比较简单,直接选择转换接口为0的接口即可.

  CTL    01 0b 00 00  02 00 00 00                         SET INTERFACE

UAC耳机调节音量

     CTL    21 01 00 02  00 02 02 00       SET CUR      
 2  OUT    8b f3

使用SET_CUR向音频控制特性单元描述符(ID=2)使用选择子VOLUME_CONTROL(0x0200)设置音量,数据长度为2。单位是DB.

UAC耳机静音设置

使用SET_CUR向音频控制特性单元描述符(ID=2)使用选择子MUTE_CONTROL(0x0100)设置静音,数据长度为1,值为1 表示静音。

CTL    21 01 00 01  00 02 01 00                            SET CUR  
OUT    01

附工作工程中的数据

每1ms192字节打包为10ms的等时传输URB数据包

1920 ISOC 
   01 00 00 00  00 00 00 00  00 00 ff ff  00 00 00 00  01 00 01 00  00 00 00 00  00 00 ff ff  ff ff 00 00
   00 00 00 00  ff ff 00 00  00 00 01 00  00 00 01 00  00 00 00 00  01 00 00 00  00 00 01 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  01 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 ff ff  00 00 ff ff  00 00 00 00  00 00 00 00  00 00 ff ff  00 00 00 00
   00 00 01 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  01 00 01 00  ff ff 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ff ff 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 ff ff  00 00 00 00  00 00 00 00  ff ff 00 00  ff ff 00 00  00 00 00 00
   00 00 00 00  ff ff 00 00  00 00 ff ff  00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00  00 00 00 00
   01 00 00 00  00 00 00 00  00 00 00 00  01 00 00 00  00 00 00 00  01 00 01 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  01 00 01 00  01 00 00 00  00 00 ff ff  00 00 00 00  00 00 ff ff  ff ff 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  01 00 01 00  01 00 00 00  ff ff 00 00  00 00 00 00  00 00 00 00  00 00 01 00
   ff ff ff ff  00 00 00 00  00 00 00 00  00 00 01 00  00 00 ff ff  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  ff ff 00 00  00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00  00 00 ff ff  01 00 01 00
   00 00 00 00  00 00 00 00  01 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 01 00  00 00 00 00  00 00 00 00  00 00 00 00  01 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 01 00  00 00 ff ff  00 00 00 00  00 00 00 00  ff ff 00 00  00 00 00 00  00 00 00 00
   00 00 ff ff  00 00 00 00  ff ff 00 00  00 00 00 00  ff ff 01 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  00 00 ff ff  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 01 00
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  00 00 00 00  01 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  01 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  00 00 01 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  ff ff 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 01 00
   00 00 ff ff  00 00 01 00  00 00 00 00  ff ff 00 00  00 00 00 00  00 00 ff ff  00 00 00 00  00 00 00 00
   01 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 ff ff  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00  00 00 01 00  00 00 00 00  01 00 00 00  01 00 ff ff
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ff ff 00 00  ff ff ff ff  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 00 00  ff ff 00 00  ff ff 00 00  00 00 00 00  00 00 00 00  00 00 ff ff
   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 01 00  01 00 00 00  ff ff 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00  00 00 01 00  00 00 00 00  00 00 00 00
   00 00 00 00  00 00 ff ff  ff ff 00 00  00 00 00 00  00 00 00 00  ff ff ff ff  00 00 00 00  00 00 ff ff
HID人机交互QQ群:564808376    UAC音频QQ群:218581009    UVC相机QQ群:331552032    BOT&UASP大容量存储QQ群:258159197    STC-USB单片机QQ群:315457461    USB技术交流QQ群2:580684376    USB技术交流QQ群:952873936   

0 篇笔记 写笔记

USB-UAC麦克风 音频控制接口
音频控制接口描述符描述了设备的结构(拓扑结构),并通过特定类请求对音频的控制。UAC麦克风 音频控制接口描述符偏移地址字段长度值描述0bLength10x09接口描术符的长度1bDescriptorType10x04描述符的类型接口描述符2bInterfaceNumber10x00接口ID号3bA......
USB音箱 UAC设备描述符分析
这里看到,USB规范采用的是USB1.1版本,不过字符串中又显示的是”USB2.0 Device”,所以这里就有点迷~关于设备描述符各字段的详细解释,详见USB规范中设备描述符一节。从bDeviceClass,bDeviceSubClass和bDeviceSubClass都被置为0来看,这是一个典......
UAC 类特定音频控制接口头描述符
UAC类特定音频控制头接口描述符这个名字有点绕,其实这个描述符是前接标准的音频控制接口描述符,后续关于音频控制的所有相关描述符,起着承上起下的作用。当然也可以认为是音频控制相关描述符的前导。这是因为UAC类特定音频控制接口描述符含有一个关键的字段wTotalLength,用于包含音频控制所有接口描述......
华为UAC耳机 音频控制接口
音频控制接口占用接口ID=0,音频控制接口的描述符结构布局如下:USB标准接口描述符UAC音频控制接口头描述符IDSId描述    音频控制输入终端描述符1USB Streaming   ......
华为UAC耳机的工作过程数据分析
华为UAC耳机工作时,首先需要打开设备,然后读取数据,播放过程后,需要关闭设备。这里我们使用BusHound抓包(省略掉重复的数据包:由于这些特定类请求是发给UAC音频控制终端/实体或接口的,所以我们先回顾一下UAC音频控制单元的一些ID,然后对照其选择子进行分析。UAC音频控制接口头描述符ID描述......
UAC 文档下载
UAC规范1.0文档下载地址:https://www.usb.org/sites/default/files/audio10.pdfUAC规范2.0文档下载地址:https://www.usb.org/sites/default/files/Audio2.0_final.zipUAC规范3.0及3.......
UAC 音频数据格式FORMAT_TYPE_3
下面来介绍USB Audio Data Formats 的第一类音频数格式 FORMAT_TYPE_III = 0x03Audio Data Format Type III Codes 其下又分为5种,分别为:NamewFormatTagTYPE_III_UNDEFINED0x2000IEC1937......
UAC 音频控制
一个USB设备可能包含多个配置。像手机一样,当手机通过USB线缆接入PC机后,会弹出一个选择对话框:让用户选择。当然一个USB设备只能工作在一种配置描述符下。对于每一个USB配置描述符,可能含有多个USB接口描述描述符,同时这些接口描述符可能每个接口描述符又包含多个转换接口描述符。这些接口描述符可能......
USB音箱 UAC Speaker 概述
手头有一个USB Speaker,插入电脑后在设备管理器中如下:从设备管理器中来看,这是一个单一功能的Usb Speaker。其硬件设备ID如下:USBVID_1908&PID_2070&REV_0100(USB Composite Device)USBVID_1908&......
USB音箱 UAC配置描述符分析
该USB音箱的配置描述符和普通USB设备描述符结构体一致,并无特别区别。该配置描述符的总长度(包括后续的所有其它描述符)为110字节,这里相对华为耳机的要少了很多,这是因为少了像麦克风和HID。从配置描述符的字段bmAttributes来看,并不支持远程唤醒功能。 ------------......
华为UAC耳机 配置描述符
配置描述符的大小其实不光包括配置描述符自身,也包括后续的所有描述符。这里我们只先介绍一下配置描述符,后续的接口描述符和其它UAC相关描述符在后续一节介绍。配置描述符的内容如下: ------------------ Configuration Descriptor --------------......
UAC 其它速率配置描述符
UAC规范中,并没有定义特别的其它速率配置描述符,故UAC音频设备的其它速率描述符应符合USB规范中的其它速率配置描述符。......
UAC Feedback端点
下面转一段对USB feedback的理解:这段时间一直在做USB Audio Device(UAC)设备的开发工作。由于UAC采用的是isochronous endpoint来传输数据,对时钟的要求较高。但无奈我们的嵌入式平台的时钟并不准,数据同步就成了问题。经过研究,发现只能使用异步模式来解决这......
USB-UAC麦克风 配置描述符
UAC麦克风采用的配置描述符结构和USB配置描述符的结构一致.偏移地址字段长度值描述0bLength10x09配置描述符的长度1bDescriptorType10x02描述符类型,配置描述符类型2wTotalLength20x0064配置描述符的总长度(包括后续的UAC音频控制和UAC音频流接口描述......
华为UAC麦克风的工作过程数据分析
看完了耳机的数据分析,再来分析麦克风,就相对来说很简单了,这是因为:第一:麦克风没有音频控制特效单元描述符,所以少了很多特定类请求。第二:麦克风只有一个音频流转换接口,且只支持采样率为48000HZ 16位。具体的过程见下:Length Phase Data-------- --......
关注公众号
  • HID人机交互
  • Linux&USB
  • UAC音频
  • TYPE-C
  • USB规范
  • USB大容量存储
  • USB百科
  • USB周边
  • UVC摄像头
  • Windows系统USB
  • 音视频博客
  • 取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

    打开支付宝扫一扫,即可进行扫码打赏哦

    您的支持,是我们前进的动力!