UAC麦克风音频流接口描述符
2021-07-23
716
0
UAC麦克风音频流接口描述符使用普通用USB接口描述符结构,该描述符是音频流描述符集合的开始。
UAC音频流描述符的组织结构如下图:
UAC麦克风音频流接口描述符的数据配置如下:
接口描述符的各字段的解释详见:USB接口描述符 http://www.usbzh.com/article/detail-64.html
源代码如下:
: /* USB_DT_INTERFACE: Interface descriptor */
struct usb_interface_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bInterfaceNumber;
__u8 bAlternateSetting;
__u8 bNumEndpoints;
__u8 bInterfaceClass;
__u8 bInterfaceSubClass;
__u8 bInterfaceProtocol;
__u8 iInterface;
}
__attribute__((packed));#
define USB_DT_INTERFACE_SIZE9
/* B.4.1 Standard AS Interface Descriptor */
static struct usb_interface_descriptor microphone_as_interface_alt_0_desc = {.bLength = USB_DT_INTERFACE_SIZE,
.bDescriptorType = USB_DT_INTERFACE,
.bAlternateSetting = 0,
.bNumEndpoints = 0,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOSTREAMING,
};
static struct usb_interface_descriptor microphone_as_interface_alt_1_desc = {.bLength = USB_DT_INTERFACE_SIZE,
.bDescriptorType = USB_DT_INTERFACE,
.bAlternateSetting = 1,
.bNumEndpoints = 1,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIOSTREAMING,
};
模拟设备信息Free Device Monitoring Studio 抓取
UAC音频采用同步传输,故需要2个接口描述符,第二个为第一个描述符的转换接口描述符即备用接口描述符。
- descriptors[5] = “Interface Descriptor”
- bLength = 9
- bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (4)
- bInterfaceNumber = 1
- bAlternateSetting = 0
- bNumEndpoints = 0
- bInterfaceClass = UsbAudio (1)
- bInterfaceSubClass = 2
- bInterfaceProtocol = 0
- iInterface = 0
转换接口描述符:
- descriptors[6] = “Interface Descriptor”
- bLength = 9
- bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (4)
- bInterfaceNumber = 1
- bAlternateSetting = 1
- bNumEndpoints = 1
- bInterfaceClass = UsbAudio (1)
- bInterfaceSubClass = 2
- bInterfaceProtocol = 0
- iInterface = 0
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936