UAC麦克见音频同步端点描述符
2021-07-23
873
0
UAC音频采用同步传输,故数据传输的端点必须为同步传输。
端点描述符的数据结构如下:
关于同步传输可详见:http://www.usbzh.com/article/detail-118.html
标准端点描述符
代码如下:
/* USB_DT_ENDPOINT: Endpoint descriptor */
struct usb_endpoint_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bEndpointAddress;
__u8 bmAttributes;
__le16 wMaxPacketSize;
__u8 bInterval; /* NOTE: these two are _only_ in audio endpoints. */ /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
__u8 bRefresh;
__u8 bSynchAddress;
}
__attribute__((packed));
/* Standard ISO IN Endpoint Descriptor */
static struct usb_endpoint_descriptor microphone_as_ep_in_desc = {.bLength = USB_DT_ENDPOINT_AUDIO_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
.wMaxPacketSize = cpu_to_le16(UAC1_IN_EP_MAX_PACKET_SIZE),
.bInterval = 4,
};
模拟设备信息( Free Device Monitoring Studio 抓取
- descriptors[9] = “Endpoint Descriptor”
- bLength = 9
- bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE(5)
- bEndpointAddress = 3
- Reserved = 0
- Direction = Input type = Isochronous(1) reserved = 1
- wMaxPacketSize = 32
- bInterval = 4
- unknown = 0, 0
UAC音频特定类的音频同步端点描述符
源码:
struct uac_iso_endpoint_descriptor {
__u8 bLength; /* in bytes: 7 */
__u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
__u8 bDescriptorSubtype; /* EP_GENERAL */
__u8 bmAttributes;
__u8 bLockDelayUnits;
__le16 wLockDelay;
}
__attribute__((packed));
/* Class-specific AS ISO IN Endpoint Descriptor */
static struct uac_iso_endpoint_descriptor microphone_as_iso_in_desc = {.bLength = UAC_ISO_ENDPOINT_DESC_SIZE,
.bDescriptorType = USB_DT_CS_ENDPOINT,
.bDescriptorSubtype = UAC_EP_GENERAL,
.bmAttributes = 1,
.bLockDelayUnits = 1,
.wLockDelay = cpu_to_le16(1),
};
模拟设备信息( Free Device Monitoring Studio 抓取
- descriptors[10] = “Class-Specific Endpoint Descriptor”
- bLength = 7
- bDescriptorType = CS_ENDPOINT(37)
- iso_endpoint =
- bmAttributes = 1
- controls =
- iso_data =
- PitchControl = 1
- DataOverrunControl = 0
- DataUnderrunControl = 0
- Reserved = 0
- bmControls = 00000001
- bLockDelayUnits = Milliseconds(1)
- wLockDelay = 1
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936