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

欢迎加入字节流官方QQ群:952873936或联系站长进行技术交流。

华为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
  • USB基础
  • USB摄像头UVC
  • USB人机交互HID
  • USB音频UAC
  • Windows基础
  • 磁盘与文件系统
  • Windows编程
  • Windows驱动
  • 开发模块
  • Windows运维
  • Linux相关
  • C语言学习
  • 高级语言
  • 前端开发
  • 服务器开发
  • 数据库
  • 字节流笔记
  • 字节流
  • 微信公众号
    字节流公众号  字节流QQ群:952873936
    取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

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

    Powered by bytekits.com,汇天下文字,成非凡梦想!!!