UAC麦克风同步传输的URB分析
2021-11-07
1307
0
之前写过同步传输的UVC摄像头的URB,文章名称为:手动分析使用BUSHOUND抓取同步传输的URB 。今天恰好手中有一个UVC麦克风,所以也拿来分析。也许和之前的文章有所重复,但是因为侧重点的不同,也许会有意想不到的小收获取。
言归正转,我们知道,在UAC音频规范中,数据的传输不像UVC摄像头那样,既支持同步传输,也支持批量传输,而是只支持同步传输。所以UAC音频设备的数据端点都是同步端点。
在Windows操作系统中,一个URB一般包含10ms的数据内容,这是因为同步传输的端点的时间周期为1ms.如本人手中的这个UAC麦克风的同步端点内容为:
------- Audio Streaming Format Type Descriptor --------
bLength : 0x11 (17 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Format Type)
bFormatType : 0x01 (FORMAT_TYPE_I)
bNrChannels : 0x01 (1 channel)
bSubframeSize : 0x02 (2 bytes per subframe)
bBitResolution : 0x10 (16 bits per sample)
bSamFreqType : 0x03 (supports 3 sample frequencies)
tSamFreq[1] : 0x0BB80 (48000 Hz)
tSamFreq[2] : 0x2EE00 (192000 Hz)
tSamFreq[3] : 0x17700 (96000 Hz)
Data (HexDump) : 11 24 02 01 01 02 10 03 80 BB 00 00 EE 02 00 77 .$.............w
01 .
----------------- Endpoint Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x82 (Direction=IN EndpointID=2)
bmAttributes : 0x05 (TransferType=Isochronous SyncType=Asynchronous EndpointType=Data)
wMaxPacketSize : 0x0180 (384 bytes)
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 82 05 80 01 01 00 00 .........
由于音频可以选择3种采样率,分别为48000,96000和192000,所以使用最大的端点字节192*2=384字节。
本人在使用的时候,一般使用的是48000的采样率,所以这里也使用48000的采样来进行抓包。
通过BUSHOUND进行抓包,发现每包抓的数据固定为960字节,即10ms的数据,由于每1ms产生96个字节,所以每URB的数据为10个ISO同步包。
我们结抓到的两个连续的URB进行分析:
12.2 URB 10 01 0a 00 00 00 00 00 48 14 24 77 7c 52 00 00 00 00 00 00 00 00 00 00 50 b8 2d dd 83 ad ff ff ISOC TRANSFER 1.2.0
05 00 00 00 c0 03 00 00 10 20 03 e1 83 ad ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1.2.32
06 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 1.2.64
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 1.2.96
StartFrame f3 48 3a 23 591022323 本包的
fd 48 3a 23 591022333 下包的
NumberOfPackets 0a 00 00 00
errcount 00 00 00 00
00 00 00 00 60 00 00 00 00 00 00 00 96=0x60
80 01 00 00 60 00 00 00 00 00 00 00
00 03 00 00 60 00 00 00 00 00 00 00
80 04 00 00 60 00 00 00 00 00 00 00
00 06 00 00 60 00 00 00 00 00 00 00
80 07 00 00 60 00 00 00 00 00 00 00
00 09 00 00 60 00 00 00 00 00 00 00 80 0a 00 00 60 00 00 00 00 00 00 00
00 0c 00 00 60 00 00 00 00 00 00 00
80 0d 00 00 60 00 00 00 00 00 00 00
URB 10 01 0a 00 00 00 00 00 48 14 24 77 7c 52 00 00 00 00 00 00 00 00 00 00 50 b8 2d dd 83 ad ff ff
05 00 00 00 c0 03 00 00 10 2f 03 e1 83 ad ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
06 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
fd 48 3a 23
0a 00 00 00 00 00 00 00 00 00 00 00 60 00 00 00 00 00 00 00 80 01 00 00 60 00 00 00
00 00 00 00 00 03 00 00 60 00 00 00 00 00 00 00 80 04 00 00 60 00 00 00 00 00 00 00 00 06 00 00
60 00 00 00 00 00 00 00 80 07 00 00 60 00 00 00 00 00 00 00 00 09 00 00 60 00 00 00 00 00 00 00
80 0a 00 00 60 00 00 00 00 00 00 00 00 0c 00 00 60 00 00 00 00 00 00 00 80 0d 00 00 60 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936