|
|
@@ -407,7 +407,14 @@ static uint8_t flightsim_report_desc[] = { |
|
|
|
#define KEYMEDIA_INTERFACE_DESC_SIZE 0 |
|
|
|
#endif |
|
|
|
|
|
|
|
#define CONFIG_DESC_SIZE KEYMEDIA_INTERFACE_DESC_POS+KEYMEDIA_INTERFACE_DESC_SIZE |
|
|
|
#define AUDIO_INTERFACE_DESC_POS KEYMEDIA_INTERFACE_DESC_POS+KEYMEDIA_INTERFACE_DESC_SIZE |
|
|
|
#ifdef AUDIO_INTERFACE |
|
|
|
#define AUDIO_INTERFACE_DESC_SIZE 9+10+12+9+12+9 + 9+9+7+11+9+7 + 9+9+7+11+9+7 |
|
|
|
#else |
|
|
|
#define AUDIO_INTERFACE_DESC_SIZE 0 |
|
|
|
#endif |
|
|
|
|
|
|
|
#define CONFIG_DESC_SIZE AUDIO_INTERFACE_DESC_POS+AUDIO_INTERFACE_DESC_SIZE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -847,6 +854,195 @@ static uint8_t config_descriptor[CONFIG_DESC_SIZE] = { |
|
|
|
KEYMEDIA_SIZE, 0, // wMaxPacketSize |
|
|
|
KEYMEDIA_INTERVAL, // bInterval |
|
|
|
#endif // KEYMEDIA_INTERFACE |
|
|
|
|
|
|
|
#ifdef AUDIO_INTERFACE |
|
|
|
// Standard AudioControl (AC) Interface Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-1, page 36 |
|
|
|
9, // bLength |
|
|
|
4, // bDescriptorType, 4 = INTERFACE |
|
|
|
AUDIO_INTERFACE, // bInterfaceNumber |
|
|
|
0, // bAlternateSetting |
|
|
|
0, // bNumEndpoints |
|
|
|
1, // bInterfaceClass, 1 = AUDIO |
|
|
|
1, // bInterfaceSubclass, 1 = AUDIO_CONTROL |
|
|
|
0, // bInterfaceProtocol |
|
|
|
0, // iInterface |
|
|
|
// Class-specific AC Interface Header Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-2, page 37-38 |
|
|
|
10, // bLength |
|
|
|
0x24, // bDescriptorType, 0x24 = CS_INTERFACE |
|
|
|
0x01, // bDescriptorSubtype, 1 = HEADER |
|
|
|
0x00, 0x01, // bcdADC (version 1.0) |
|
|
|
LSB(52), MSB(52), // wTotalLength |
|
|
|
2, // bInCollection |
|
|
|
AUDIO_INTERFACE+1, // baInterfaceNr(1) - Transmit to PC |
|
|
|
AUDIO_INTERFACE+2, // baInterfaceNr(2) - Receive from PC |
|
|
|
// Input Terminal Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-3, page 39 |
|
|
|
12, // bLength |
|
|
|
0x24, // bDescriptorType, 0x24 = CS_INTERFACE |
|
|
|
0x02, // bDescriptorSubType, 2 = INPUT_TERMINAL |
|
|
|
1, // bTerminalID |
|
|
|
//0x01, 0x02, // wTerminalType, 0x0201 = MICROPHONE |
|
|
|
//0x03, 0x06, // wTerminalType, 0x0603 = Line Connector |
|
|
|
0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio |
|
|
|
0, // bAssocTerminal, 0 = unidirectional |
|
|
|
2, // bNrChannels |
|
|
|
0x00, 0x03, // wChannelConfig, 0x0003 = Left & Right Front |
|
|
|
0, // iChannelNames |
|
|
|
0, // iTerminal |
|
|
|
// Output Terminal Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-4, page 40 |
|
|
|
9, // bLength |
|
|
|
0x24, // bDescriptorType, 0x24 = CS_INTERFACE |
|
|
|
3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL |
|
|
|
2, // bTerminalID |
|
|
|
0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING |
|
|
|
0, // bAssocTerminal, 0 = unidirectional |
|
|
|
1, // bCSourceID, connected to input terminal, ID=1 |
|
|
|
0, // iTerminal |
|
|
|
// Input Terminal Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-3, page 39 |
|
|
|
12, // bLength |
|
|
|
0x24, // bDescriptorType, 0x24 = CS_INTERFACE |
|
|
|
2, // bDescriptorSubType, 2 = INPUT_TERMINAL |
|
|
|
3, // bTerminalID |
|
|
|
0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING |
|
|
|
0, // bAssocTerminal, 0 = unidirectional |
|
|
|
2, // bNrChannels |
|
|
|
0x00, 0x03, // wChannelConfig, 0x0003 = Left & Right Front |
|
|
|
0, // iChannelNames |
|
|
|
0, // iTerminal |
|
|
|
// Output Terminal Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Table 4-4, page 40 |
|
|
|
9, // bLength |
|
|
|
0x24, // bDescriptorType, 0x24 = CS_INTERFACE |
|
|
|
3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL |
|
|
|
4, // bTerminalID |
|
|
|
//0x02, 0x03, // wTerminalType, 0x0302 = Headphones |
|
|
|
0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio |
|
|
|
0, // bAssocTerminal, 0 = unidirectional |
|
|
|
3, // bCSourceID, connected to input terminal, ID=3 |
|
|
|
0, // iTerminal |
|
|
|
// Standard AS Interface Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59 |
|
|
|
// Alternate 0: default setting, disabled zero bandwidth |
|
|
|
9, // bLenght |
|
|
|
4, // bDescriptorType = INTERFACE |
|
|
|
AUDIO_INTERFACE+1, // bInterfaceNumber |
|
|
|
0, // bAlternateSetting |
|
|
|
0, // bNumEndpoints |
|
|
|
1, // bInterfaceClass, 1 = AUDIO |
|
|
|
2, // bInterfaceSubclass, 2 = AUDIO_STREAMING |
|
|
|
0, // bInterfaceProtocol |
|
|
|
0, // iInterface |
|
|
|
// Alternate 1: streaming data |
|
|
|
9, // bLenght |
|
|
|
4, // bDescriptorType = INTERFACE |
|
|
|
AUDIO_INTERFACE+1, // bInterfaceNumber |
|
|
|
1, // bAlternateSetting |
|
|
|
1, // bNumEndpoints |
|
|
|
1, // bInterfaceClass, 1 = AUDIO |
|
|
|
2, // bInterfaceSubclass, 2 = AUDIO_STREAMING |
|
|
|
0, // bInterfaceProtocol |
|
|
|
0, // iInterface |
|
|
|
// Class-Specific AS Interface Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60 |
|
|
|
7, // bLength |
|
|
|
0x24, // bDescriptorType = CS_INTERFACE |
|
|
|
1, // bDescriptorSubtype, 1 = AS_GENERAL |
|
|
|
2, // bTerminalLink: Terminal ID = 2 |
|
|
|
3, // bDelay (approx 3ms delay, audio lib updates) |
|
|
|
0x01, 0x00, // wFormatTag, 0x0001 = PCM |
|
|
|
// Type I Format Descriptor |
|
|
|
// USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10 |
|
|
|
11, // bLength |
|
|
|
0x24, // bDescriptorType = CS_INTERFACE |
|
|
|
2, // bDescriptorSubtype = FORMAT_TYPE |
|
|
|
1, // bFormatType = FORMAT_TYPE_I |
|
|
|
2, // bNrChannels = 2 |
|
|
|
2, // bSubFrameSize = 2 byte |
|
|
|
16, // bBitResolution = 16 bits |
|
|
|
1, // bSamFreqType = 1 frequency |
|
|
|
LSB(44100), MSB(44100), 0, // tSamFreq |
|
|
|
// Standard AS Isochronous Audio Data Endpoint Descriptor |
|
|
|
// SB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62 |
|
|
|
9, // bLength |
|
|
|
5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR |
|
|
|
AUDIO_TX_ENDPOINT | 0x80, // bEndpointAddress |
|
|
|
0x05, // bmAttributes = isochronous, asynchronous |
|
|
|
LSB(AUDIO_TX_SIZE), MSB(AUDIO_TX_SIZE), // wMaxPacketSize |
|
|
|
1, // bInterval, 1 = every frame |
|
|
|
0, // bRefresh |
|
|
|
0, // bSynchAddress |
|
|
|
// Class-Specific AS Isochronous Audio Data Endpoint Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63 |
|
|
|
7, // bLength |
|
|
|
0x25, // bDescriptorType, 0x25 = CS_ENDPOINT |
|
|
|
1, // bDescriptorSubtype, 1 = EP_GENERAL |
|
|
|
0x01, // bmAttributes = Sampling Frequency |
|
|
|
1, // bLockDelayUnits, 1 = ms |
|
|
|
0x30, 0x00, // wLockDelay |
|
|
|
// Standard AS Interface Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59 |
|
|
|
// Alternate 0: default setting, disabled zero bandwidth |
|
|
|
9, // bLenght |
|
|
|
4, // bDescriptorType = INTERFACE |
|
|
|
AUDIO_INTERFACE+2, // bInterfaceNumber |
|
|
|
0, // bAlternateSetting |
|
|
|
0, // bNumEndpoints |
|
|
|
1, // bInterfaceClass, 1 = AUDIO |
|
|
|
2, // bInterfaceSubclass, 2 = AUDIO_STREAMING |
|
|
|
0, // bInterfaceProtocol |
|
|
|
0, // iInterface |
|
|
|
// Alternate 1: streaming data |
|
|
|
9, // bLenght |
|
|
|
4, // bDescriptorType = INTERFACE |
|
|
|
AUDIO_INTERFACE+2, // bInterfaceNumber |
|
|
|
1, // bAlternateSetting |
|
|
|
1, // bNumEndpoints |
|
|
|
1, // bInterfaceClass, 1 = AUDIO |
|
|
|
2, // bInterfaceSubclass, 2 = AUDIO_STREAMING |
|
|
|
0, // bInterfaceProtocol |
|
|
|
0, // iInterface |
|
|
|
// Class-Specific AS Interface Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60 |
|
|
|
7, // bLength |
|
|
|
0x24, // bDescriptorType = CS_INTERFACE |
|
|
|
1, // bDescriptorSubtype, 1 = AS_GENERAL |
|
|
|
3, // bTerminalLink: Terminal ID = 3 |
|
|
|
3, // bDelay (approx 3ms delay, audio lib updates) |
|
|
|
0x01, 0x00, // wFormatTag, 0x0001 = PCM |
|
|
|
// Type I Format Descriptor |
|
|
|
// USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10 |
|
|
|
11, // bLength |
|
|
|
0x24, // bDescriptorType = CS_INTERFACE |
|
|
|
2, // bDescriptorSubtype = FORMAT_TYPE |
|
|
|
1, // bFormatType = FORMAT_TYPE_I |
|
|
|
2, // bNrChannels = 2 |
|
|
|
2, // bSubFrameSize = 2 byte |
|
|
|
16, // bBitResolution = 16 bits |
|
|
|
1, // bSamFreqType = 1 frequency |
|
|
|
LSB(44100), MSB(44100), 0, // tSamFreq |
|
|
|
// Standard AS Isochronous Audio Data Endpoint Descriptor |
|
|
|
// SB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62 |
|
|
|
9, // bLength |
|
|
|
5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR |
|
|
|
AUDIO_RX_ENDPOINT, // bEndpointAddress |
|
|
|
0x05, // bmAttributes = isochronous, asynchronous |
|
|
|
LSB(AUDIO_RX_SIZE), MSB(AUDIO_RX_SIZE), // wMaxPacketSize |
|
|
|
1, // bInterval, 1 = every frame |
|
|
|
0, // bRefresh |
|
|
|
0, // bSynchAddress |
|
|
|
// Class-Specific AS Isochronous Audio Data Endpoint Descriptor |
|
|
|
// USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63 |
|
|
|
7, // bLength |
|
|
|
0x25, // bDescriptorType, 0x25 = CS_ENDPOINT |
|
|
|
1, // bDescriptorSubtype, 1 = EP_GENERAL |
|
|
|
0x01, // bmAttributes = Sampling Frequency |
|
|
|
1, // bLockDelayUnits, 1 = ms |
|
|
|
0x30, 0x00, // wLockDelay |
|
|
|
#endif |
|
|
|
}; |
|
|
|
|
|
|
|
|