UAC调节采样率
博主你好,请教一个UAC的问题。如下:
我这个是USB扬声器,插上USB时,可以调节采样率,但是在调节声音时,第一次抓包正常,第二次抓包就会出现 stall pid。
抓包内容如下:
60.0 CTL 01 0b 01 00 01 00 00 00 SET INTERFACE 1.1.0 usbaudio
60.0 CTL 22 01 00 01 01 00 03 00 SET CUR 2.1.0 usbaudio
60.0 3 OUT 80 3e 00 .>. 2.2.0
60.0 CTL 01 0b 00 00 01 00 00 00 SET INTERFACE 3.1.0(2) usbaudio
60.0 CTL 01 0b 01 00 01 00 00 00 SET INTERFACE 4.1.0(2) usbaudio
60.0 CTL 22 01 00 01 01 00 03 00 SET CUR 5.1.0(2) usbaudio
60.0 3 OUT 80 bb 00 ... 5.2.0
60.1 960 ISOC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 9.1.0 usbaudio
... 中间还有好多ISOC
60.1 960 ISOC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 261.1.0(36) usbaudio
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 261.1.16
60.0 CTL 01 0b 00 00 01 00 00 00 SET INTERFACE 297.1.0 usbaudio
60.0 CTL 01 0b 01 00 01 00 00 00 SET INTERFACE 298.1.0 usbaudio
60.0 CTL 22 01 00 01 01 00 03 00 SET CUR 299.1.0 usbaudio
60.0 USTS c0000004 stall pid 299.2.0
60.0 CTL 01 0b 00 00 01 00 00 00 SET INTERFACE 300.1.0 usbaudio
60.0 USTS c0000004 stall pid 300.2.0
60.0 CTL 01 0b 01 00 01 00 00 00 SET INTERFACE 301.1.0(7) usbaudio
60.0 USTS c0000004 stall pid 301.2.0
USBTreeViewer 显示设备信息如下
=========================== USB Port2 ===========================
Connection Status : 0x01 (Device is connected)
Port Chain : 1-1-2
Properties : 0x01
IsUserConnectable : yes
PortIsDebugCapable : no
PortHasMultiCompanions : no
PortConnectorIsTypeC : no
ConnectionIndex : 2
CompanionIndex : 0
CompanionHubSymLnk : USB#VID_05E3&PID_0612#5&28908f0&0&17#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
CompanionPortNumber : 2
-> CompanionPortChain : 1-17-2
======================== USB Device ========================
+++++++++++++++++ Device Information ++++++++++++++++++
Device Description : USB Composite Device
Device Path : \\?\USB#VID_2F12&PID_0D25#48F06F473032#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name : \Device\USBPDO-10
Device ID : USB\VID_2F12&PID_0D25\48F06F473032
Hardware IDs : USB\VID_2F12&PID_0D25&REV_0200 USB\VID_2F12&PID_0D25
Driver KeyName : {36fc9e60-c465-11cf-8056-444553540000}\0034 (GUID_DEVCLASS_USB)
Driver : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.19041.2546 Date: 2023-02-15)
Driver Inf : C:\Windows\inf\usb.inf
Legacy BusType : PNPBus
Class : USB
Class GUID : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service : usbccgp
Enumerator : USB
Location Info : Port_#0002.Hub_#0002
Location IDs : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)#USB(2), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS01)#USB(2)
Container ID : {96099a5f-3017-5f62-8914-32e85e4f94ce}
Manufacturer Info : (标准 USB 主控制器)
Capabilities : 0x94 (Removable, UniqueID, SurpriseRemovalOK)
Status : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
Address : 2
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend : 0
SelectiveSuspendEnabled : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState : 0
WakeFromSleepState : 0
Power State : D0 (supported: D0, D2, D3, wake from D0, wake from D2)
Child Device 1 : STM32 Speaker (USB Audio Device)
Device Path 1 : \\?\USB#VID_2F12&PID_0D25&MI_00#7&18bfe16b&0&0000#{65e8773e-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_RENDER)
Device Path 2 : \\?\USB#VID_2F12&PID_0D25&MI_00#7&18bfe16b&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global (AM_KSCATEGORY_AUDIO)
Kernel Name : \Device\000008da
Device ID : USB\VID_2F12&PID_0D25&MI_00\7&18BFE16B&0&0000
Class : MEDIA
Driver KeyName : {4d36e96c-e325-11ce-bfc1-08002be10318}\0016 (GUID_DEVCLASS_MEDIA)
Service : usbaudio
Child Device 1 : 扬声器 (2- STM32 Speaker) (音频端点)
Device Path : \\?\SWD#MMDEVAPI#{0.0.0.00000000}.{e1b1dfb1-0305-4b92-ac99-3d912cc6823c}#{e6327cad-dcec-4949-ae8a-991e976a79d2} (DEVINTERFACE_AUDIO_RENDER)
Kernel Name : \Device\000008dc
Device ID : SWD\MMDEVAPI\{0.0.0.00000000}.{E1B1DFB1-0305-4B92-AC99-3D912CC6823C}
Class : AudioEndpoint
Driver KeyName : {c166523c-fe0c-4a94-a586-f1a80cfbbf3e}\0019 (AUDIOENDPOINT_CLASS_UUID)
---------------- Connection Information ---------------
Connection Index : 0x02 (2)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01
Device Address : 0x2D (45)
Is Hub : 0x00 (no)
Device Bus Speed : 0x01 (Full-Speed)
Number Of Open Pipes : 0x00 (0 pipes to data endpoints)
Data (HexDump) : 02 00 00 00 12 01 10 01 00 00 00 40 12 2F 25 0D ...........@./%.
00 02 01 02 03 01 01 01 00 2D 00 00 00 00 00 01 .........-......
00 00 00 ...
--------------- Connection Information V2 -------------
Connection Index : 0x02 (2)
Length : 0x10 (16 bytes)
SupportedUsbProtocols : 0x03
Usb110 : 1 (yes)
Usb200 : 1 (yes)
Usb300 : 0 (no)
ReservedMBZ : 0x00
Flags : 0x00
DevIsOpAtSsOrHigher : 0 (Is not operating at SuperSpeed or higher)
DevIsSsCapOrHigher : 0 (Is not SuperSpeed capable or higher)
DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)
DevIsSsPlusCapOrHigher : 0 (Is not SuperSpeedPlus capable or higher)
ReservedMBZ : 0x00
Data (HexDump) : 02 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 ................
---------------------- Device Descriptor ----------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x110 (USB Version 1.10)
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x2F12 (LucidSound, Inc.)
idProduct : 0x0D25
bcdDevice : 0x0200
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "ST"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "STM32 Speaker"
iSerialNumber : 0x03 (String Descriptor 3)
Language 0x0409 : "48F06F473032"
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 10 01 00 00 00 40 12 2F 25 0D 00 02 01 02 .......@./%.....
03 01 ..
------------------ Configuration Descriptor -------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x009F (159 bytes)
bNumInterfaces : 0x02 (2 Interfaces)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0x80
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x00 (no)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x32 (100 mA)
Data (HexDump) : 09 02 9F 00 02 01 00 80 32 09 04 00 00 00 01 01 ........2.......
00 00 09 24 01 00 01 28 00 01 01 0C 24 02 01 01 ...$...(....$...
01 00 02 03 00 00 00 0A 24 06 02 01 01 01 00 00 ........$.......
00 09 24 03 03 01 03 00 02 00 09 04 01 00 00 01 ..$.............
02 00 00 09 04 01 01 01 01 02 00 00 07 24 01 01 .............$..
00 01 00 0E 24 02 01 01 02 10 02 80 3E 00 80 BB ....$.......>...
00 09 05 01 0D C0 00 01 00 00 07 25 01 01 00 00 ...........%....
00 09 04 01 02 01 01 02 00 00 07 24 01 01 00 01 ...........$....
00 0E 24 02 01 02 02 10 02 80 3E 00 80 BB 00 09 ..$.......>.....
05 01 0D C0 00 01 00 00 07 25 01 01 00 00 00 .........%.....
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00
bAlternateSetting : 0x00
bNumEndpoints : 0x00 (Default Control Pipe only)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x01 (Audio Control)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 00 01 01 00 00 .........
------ Audio Control Interface Header Descriptor ------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01 (Header)
bcdADC : 0x0100
wTotalLength : 0x0028 (40 bytes)
bInCollection : 0x01
baInterfaceNr[1] : 0x01
Data (HexDump) : 09 24 01 00 01 28 00 01 01 .$...(...
------- Audio Control Input Terminal Descriptor -------
bLength : 0x0C (12 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Input Terminal)
bTerminalID : 0x01
wTerminalType : 0x0101 (USB streaming)
bAssocTerminal : 0x00
bNrChannels : 0x02 (2 channels)
wChannelConfig : 0x0003 (L, R)
iChannelNames : 0x00 (No String Descriptor)
iTerminal : 0x00 (No String Descriptor)
Data (HexDump) : 0C 24 02 01 01 01 00 02 03 00 00 00 .$..........
-------- Audio Control Feature Unit Descriptor --------
bLength : 0x0A (10 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x06 (Feature Unit)
bUnitID : 0x02 (2)
bSourceID : 0x01 (1)
bControlSize : 0x01 (1 byte per control)
bmaControls[0] : 0x01
D0: Mute : 1
D1: Volume : 0
D2: Bass : 0
D3: Mid : 0
D4: Treble : 0
D5: Graphic Equalizer : 0
D6: Automatic Gain : 0
D7: Delay : 0
bmaControls[1] : 0x00
D0: Mute : 0
D1: Volume : 0
D2: Bass : 0
D3: Mid : 0
D4: Treble : 0
D5: Graphic Equalizer : 0
D6: Automatic Gain : 0
D7: Delay : 0
bmaControls[2] : 0x00
D0: Mute : 0
D1: Volume : 0
D2: Bass : 0
D3: Mid : 0
D4: Treble : 0
D5: Graphic Equalizer : 0
D6: Automatic Gain : 0
D7: Delay : 0
iFeature : 0x00 (No String Descriptor)
Data (HexDump) : 0A 24 06 02 01 01 01 00 00 00 .$........
------- Audio Control Output Terminal Descriptor ------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x03 (Output Terminal)
bTerminalID : 0x03
wTerminalType : 0x0301 (Speaker)
bAssocTerminal : 0x00 (0)
bSourceID : 0x02 (2)
iTerminal : 0x00 (No String Descriptor)
Data (HexDump) : 09 24 03 03 01 03 00 02 00 .$.......
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x00
bNumEndpoints : 0x00 (Default Control Pipe only)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 00 00 01 02 00 00 .........
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x01
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 01 01 01 02 00 00 .........
-------- Audio Streaming Interface Descriptor ---------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01
bTerminalLink : 0x01
bDelay : 0x00
wFormatTag : 0x0001 (PCM)
Data (HexDump) : 07 24 01 01 00 01 00 .$.....
------- Audio Streaming Format Type Descriptor --------
bLength : 0x0E (14 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 : 0x02 (supports 2 sample frequencies)
tSamFreq[1] : 0x03E80 (16000 Hz)
tSamFreq[2] : 0x0BB80 (48000 Hz)
Data (HexDump) : 0E 24 02 01 01 02 10 02 80 3E 00 80 BB 00 .$.......>....
----------------- Endpoint Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x01 (Direction=OUT EndpointID=1)
bmAttributes : 0x0D (TransferType=Isochronous SyncType=Synchronous EndpointType=Data)
wMaxPacketSize : 0x00C0 (192 bytes)
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 01 0D C0 00 01 00 00 .........
----------- Audio Data Endpoint Descriptor ------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype : 0x01 (General)
bmAttributes : 0x01
D0 : Sampling Freq : 0x01 (supported)
D1 : Pitch : 0x00 (not supported)
D6..2: Reserved : 0x00
D7 : MaxPacketsOnly : 0x00 (no)
bLockDelayUnits : 0x00 (Undefined)
wLockDelay : 0x0000
Data (HexDump) : 07 25 01 01 00 00 00 .%.....
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x02
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 02 01 01 02 00 00 .........
-------- Audio Streaming Interface Descriptor ---------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01
bTerminalLink : 0x01
bDelay : 0x00
wFormatTag : 0x0001 (PCM)
Data (HexDump) : 07 24 01 01 00 01 00 .$.....
------- Audio Streaming Format Type Descriptor --------
bLength : 0x0E (14 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Format Type)
bFormatType : 0x01 (FORMAT_TYPE_I)
bNrChannels : 0x02 (2 channels)
bSubframeSize : 0x02 (2 bytes per subframe)
bBitResolution : 0x10 (16 bits per sample)
bSamFreqType : 0x02 (supports 2 sample frequencies)
tSamFreq[1] : 0x03E80 (16000 Hz)
tSamFreq[2] : 0x0BB80 (48000 Hz)
Data (HexDump) : 0E 24 02 01 02 02 10 02 80 3E 00 80 BB 00 .$.......>....
----------------- Endpoint Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x01 (Direction=OUT EndpointID=1)
bmAttributes : 0x0D (TransferType=Isochronous SyncType=Synchronous EndpointType=Data)
wMaxPacketSize : 0x00C0 (192 bytes)
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 01 0D C0 00 01 00 00 .........
----------- Audio Data Endpoint Descriptor ------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype : 0x01 (General)
bmAttributes : 0x01
D0 : Sampling Freq : 0x01 (supported)
D1 : Pitch : 0x00 (not supported)
D6..2: Reserved : 0x00
D7 : MaxPacketsOnly : 0x00 (no)
bLockDelayUnits : 0x00 (Undefined)
wLockDelay : 0x0000
Data (HexDump) : 07 25 01 01 00 00 00 .%.....
-------------------- String Descriptors -------------------
------ String Descriptor 0 ------
bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x06 (6 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "ST"
Data (HexDump) : 06 03 53 00 54 00 ..S.T.
------ String Descriptor 2 ------
bLength : 0x1C (28 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "STM32 Speaker"
Data (HexDump) : 1C 03 53 00 54 00 4D 00 33 00 32 00 20 00 53 00 ..S.T.M.3.2. .S.
70 00 65 00 61 00 6B 00 65 00 72 00 p.e.a.k.e.r.
------ String Descriptor 3 ------
bLength : 0x1A (26 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "48F06F473032"
Data (HexDump) : 1A 03 34 00 38 00 46 00 30 00 36 00 46 00 34 00 ..4.8.F.0.6.F.4.
37 00 33 00 30 00 33 00 32 00 7.3.0.3.2.