1 // SPDX-License-Identifier: GPL-2.0+
3 * USB descriptor definitions
5 * Copyright (C) 2017-2018 Michael Drake <michael.drake@codethink.co.uk>
14 #include "desc-defs.h"
16 /** Macro for computing number of elements in array. */
17 #define ARRAY_LEN(a) ((sizeof(a)) / (sizeof(a[0])))
20 * Undefined descriptor
22 * Ensures remaining data is dumped as garbage at end of descriptor.
24 const struct desc desc_undefined[] = {
28 /** USB Audio Device Class 1 Channel Names. (Note: Order matters.) */
29 static const char * const uac1_channel_names[] = {
30 "Left Front (L)", "Right Front (R)", "Center Front (C)",
31 "Low Frequency Enhancement (LFE)", "Left Surround (LS)",
32 "Right Surround (RS)", "Left of Center (LC)", "Right of Center (RC)",
33 "Surround (S)", "Side Left (SL)", "Side Right (SR)", "Top (T)"
36 /** USB Audio Device Class 2 Channel Names. (Note: Order matters.) */
37 static const char * const uac2_channel_names[] = {
38 "Front Left (FL)", "Front Right (FR)", "Front Center (FC)",
39 "Low Frequency Effects (LFE)", "Back Left (BL)", "Back Right (BR)",
40 "Front Left of Center (FLC)", "Front Right of Center (FRC)",
41 "Back Center (BC)", "Side Left (SL)", "Side Right (SR)",
42 "Top Center (TC)", "Top Front Left (TFL)", "Top Front Center (TFC)",
43 "Top Front Right (TFR)", "Top Back Left (TBL)", "Top Back Center (TBC)",
44 "Top Back Right (TBR)", "Top Front Left of Center (TFLC)",
45 "Top Front Right of Center (TFRC)", "Left Low Frequency Effects (LLFE)",
46 "Right Low Frequency Effects (RLFE)", "Top Side Left (TSL)",
47 "Top Side Right (TSR)", "Bottom Center (BC)",
48 "Back Left of Center (BLC)", "Back Right of Center (BRC)"
51 /** Audio Control Interface Header bmControls; Human readable bit meanings. */
52 static const char * const uac2_interface_header_bmcontrols[] = {
53 [0] = "Latency control",
57 /** UAC1: 4.3.2 Class-Specific AC Interface Descriptor; Table 4-2. */
58 static const struct desc desc_audio_1_ac_header[] = {
59 { .field = "bcdADC", .size = 2, .type = DESC_BCD },
60 { .field = "wTotalLength", .size = 2, .type = DESC_CONSTANT },
61 { .field = "bInCollection", .size = 1, .type = DESC_CONSTANT },
62 { .field = "baInterfaceNr", .size = 1, .type = DESC_NUMBER,
63 .array = { .array = true } },
67 /** UAC2: 4.7.2 Class-Specific AC Interface Descriptor; Table 4-5. */
68 static const struct desc desc_audio_2_ac_header[] = {
69 { .field = "bcdADC", .size = 2, .type = DESC_BCD },
70 { .field = "bCategory", .size = 1, .type = DESC_CONSTANT },
71 { .field = "wTotalLength", .size = 2, .type = DESC_NUMBER },
72 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
73 .bmcontrol = uac2_interface_header_bmcontrols },
77 /** UAC3: 4.5.2 Class-Specific AC Interface Descriptor; Table 4-15. */
78 static const struct desc desc_audio_3_ac_header[] = {
79 { .field = "bCategory", .size = 1, .type = DESC_CONSTANT },
80 { .field = "wTotalLength", .size = 2, .type = DESC_NUMBER },
81 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
82 .bmcontrol = uac2_interface_header_bmcontrols },
86 /** AudioControl Header descriptor definitions for the three Audio Device Class protocols */
87 const struct desc * const desc_audio_ac_header[3] = {
88 desc_audio_1_ac_header,
89 desc_audio_2_ac_header,
90 desc_audio_3_ac_header,
93 /** UAC2: 4.7.2.10 Effect Unit Descriptor; Table 4-15. */
94 static const struct desc desc_audio_2_ac_effect_unit[] = {
95 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
96 { .field = "wEffectType", .size = 2, .type = DESC_CONSTANT },
97 { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT },
98 { .field = "bmaControls", .size = 4, .type = DESC_BITMAP,
99 .array = { .array = true } },
100 { .field = "iEffects", .size = 1, .type = DESC_STR_DESC_INDEX },
104 /** UAC3: 4.5.2.9 Effect Unit Descriptor; Table 4-33. */
105 static const struct desc desc_audio_3_ac_effect_unit[] = {
106 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
107 { .field = "wEffectType", .size = 2, .type = DESC_CONSTANT },
108 { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT },
109 { .field = "bmaControls", .size = 4, .type = DESC_BITMAP,
110 .array = { .array = true } },
111 { .field = "wEffectsDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
115 /** Effect Unit descriptor definitions for the three Audio Device Class protocols */
116 const struct desc * const desc_audio_ac_effect_unit[3] = {
117 NULL, /* UAC1 not supported */
118 desc_audio_2_ac_effect_unit,
119 desc_audio_3_ac_effect_unit,
122 /** UAC2 Input Terminal bmControls; Human readable bit meanings. */
123 static const char * const uac2_input_term_bmcontrols[] = {
124 [0] = "Copy Protect",
133 /** UAC3 Input Terminal bmControls; Human readable bit meanings. */
134 static const char * const uac3_input_term_bmcontrols[] = {
143 /** UAC1: 4.3.2.1 Input Terminal Descriptor; Table 4-3. */
144 static const struct desc desc_audio_1_ac_input_terminal[] = {
145 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
146 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
147 { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT },
148 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
149 { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS,
150 .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } },
151 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
152 { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX },
156 /** UAC2: 4.7.2.4 Input Terminal Descriptor; Table 4-9. */
157 static const struct desc desc_audio_2_ac_input_terminal[] = {
158 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
159 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
160 { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT },
161 { .field = "bCSourceID", .size = 1, .type = DESC_CONSTANT },
162 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
163 { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS,
164 .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } },
165 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
166 { .field = "bmControls", .size = 2, .type = DESC_BMCONTROL_2,
167 .bmcontrol = uac2_input_term_bmcontrols },
168 { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX },
172 /** UAC3: 4.5.2.1 Input Terminal Descriptor; Table 4-16. */
173 static const struct desc desc_audio_3_ac_input_terminal[] = {
174 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
175 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
176 { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER },
177 { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER },
178 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
179 .bmcontrol = uac3_input_term_bmcontrols },
180 { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER },
181 { .field = "wExTerminalDescrID", .size = 2, .type = DESC_NUMBER },
182 { .field = "wConnectorsDescrID", .size = 2, .type = DESC_NUMBER },
183 { .field = "wTerminalDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
187 /** Input Terminal descriptor definitions for the three Audio Device Class protocols */
188 const struct desc * const desc_audio_ac_input_terminal[3] = {
189 desc_audio_1_ac_input_terminal,
190 desc_audio_2_ac_input_terminal,
191 desc_audio_3_ac_input_terminal,
194 /** UAC2 Output Terminal bmControls; Human readable bit meanings. */
195 static const char * const uac2_output_term_bmcontrols[] = {
196 [0] = "Copy Protect",
204 /** UAC3 Output Terminal bmControls; Human readable bit meanings. */
205 static const char * const uac3_output_term_bmcontrols[] = {
213 /** UAC1: 4.3.2.2 Output Terminal Descriptor; Table 4-4. */
214 static const struct desc desc_audio_1_ac_output_terminal[] = {
215 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
216 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
217 { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER },
218 { .field = "bSourceID", .size = 1, .type = DESC_NUMBER },
219 { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX },
223 /** UAC2: 4.7.2.5 Output Terminal Descriptor; Table 4-10. */
224 static const struct desc desc_audio_2_ac_output_terminal[] = {
225 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
226 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
227 { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER },
228 { .field = "bSourceID", .size = 1, .type = DESC_NUMBER },
229 { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER },
230 { .field = "bmControls", .size = 2, .type = DESC_BMCONTROL_2,
231 .bmcontrol = uac2_output_term_bmcontrols },
232 { .field = "iTerminal", .size = 1, .type = DESC_STR_DESC_INDEX },
236 /** UAC3: 4.5.2.2 Output Terminal Descriptor; Table 4-17. */
237 static const struct desc desc_audio_3_ac_output_terminal[] = {
238 { .field = "bTerminalID", .size = 1, .type = DESC_NUMBER },
239 { .field = "wTerminalType", .size = 2, .type = DESC_TERMINAL_STR },
240 { .field = "bAssocTerminal", .size = 1, .type = DESC_NUMBER },
241 { .field = "bSourceID", .size = 1, .type = DESC_NUMBER },
242 { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER },
243 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
244 .bmcontrol = uac3_output_term_bmcontrols },
245 { .field = "wExTerminalDescrID", .size = 2, .type = DESC_NUMBER },
246 { .field = "wConnectorsDescrID", .size = 2, .type = DESC_NUMBER },
247 { .field = "wTerminalDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
251 /** Output Terminal descriptor definitions for the three Audio Device Class protocols */
252 const struct desc * const desc_audio_ac_output_terminal[3] = {
253 desc_audio_1_ac_output_terminal,
254 desc_audio_2_ac_output_terminal,
255 desc_audio_3_ac_output_terminal,
258 /** UAC3: 4.5.2.3.1 Extended Terminal Header Descriptor; Table 4-18. */
259 static const struct desc desc_audio_3_ac_extended_terminal_header[] = {
260 { .field = "wDescriptorID", .size = 2, .type = DESC_NUMBER },
261 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
265 /** Extended Terminal descriptor definitions for the three Audio Device Class protocols */
266 const struct desc * const desc_audio_ac_extended_terminal[3] = {
267 NULL, /* UAC1 not supported */
268 NULL, /* UAC2 not supported */
269 desc_audio_3_ac_extended_terminal_header,
272 /** UAC3: 4.5.2.15 Power Domain Descriptor; Table 4-46. */
273 static const struct desc desc_audio_3_ac_power_domain[] = {
274 { .field = "bPowerDomainID", .size = 1, .type = DESC_NUMBER },
275 { .field = "waRecoveryTime(1)", .size = 2, .type = DESC_NUMBER },
276 { .field = "waRecoveryTime(2)", .size = 2, .type = DESC_NUMBER },
277 { .field = "bNrEntities", .size = 1, .type = DESC_NUMBER },
278 { .field = "baEntityID", .size = 1, .type = DESC_NUMBER,
279 .array = { .array = true, .length_field1 = "bNrEntities" } },
280 { .field = "wPDomainDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
284 /** Power Domain descriptor definitions for the three Audio Device Class protocols */
285 const struct desc * const desc_audio_ac_power_domain[3] = {
286 NULL, /* UAC1 not supported */
287 NULL, /* UAC2 not supported */
288 desc_audio_3_ac_power_domain,
291 /** UAC2 Mixer Unit bmControls; Human readable bit meanings. */
292 static const char * const uac2_mixer_unit_bmcontrols[] = {
299 /** UAC3 Mixer Unit bmControls; Human readable bit meanings. */
300 static const char * const uac3_mixer_unit_bmcontrols[] = {
306 /** UAC1: 4.3.2.3 Mixer Unit Descriptor; Table 4-5. */
307 static const struct desc desc_audio_1_ac_mixer_unit[] = {
308 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
309 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
310 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
311 .array = { .array = true, .length_field1 = "bNrInPins" } },
312 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
313 { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS,
314 .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } },
315 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
316 { .field = "bmControls", .size = 1, .type = DESC_BITMAP,
317 .array = { .array = true, .bits = true,
318 .length_field1 = "bNrInPins",
319 .length_field2 = "bNrChannels" } },
320 { .field = "iMixer", .size = 1, .type = DESC_STR_DESC_INDEX },
324 /** UAC2: 4.7.2.6 Mixer Unit Descriptor; Table 4-11. */
325 static const struct desc desc_audio_2_ac_mixer_unit[] = {
326 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
327 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
328 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
329 .array = { .array = true, .length_field1 = "bNrInPins" } },
330 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
331 { .field = "bmChannelConfig",.size = 4, .type = DESC_BITMAP_STRINGS,
332 .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } },
333 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
334 { .field = "bmMixerControls",.size = 1, .type = DESC_BITMAP,
335 .array = { .array = true, .bits = true,
336 .length_field1 = "bNrInPins",
337 .length_field2 = "bNrChannels" } },
338 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
339 .bmcontrol = uac2_mixer_unit_bmcontrols },
340 { .field = "iMixer", .size = 1, .type = DESC_STR_DESC_INDEX },
344 /** UAC3: 4.5.2.5 Mixer Unit Descriptor; Table 4-29. */
345 static const struct desc desc_audio_3_ac_mixer_unit[] = {
346 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
347 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
348 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
349 .array = { .array = true, .length_field1 = "bNrInPins" } },
350 { .field = "wClusterDescrID",.size = 2, .type = DESC_NUMBER },
351 { .field = "bmMixerControls",.size = 1, .type = DESC_BITMAP,
352 .array = { .array = true } },
353 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
354 .bmcontrol = uac3_mixer_unit_bmcontrols },
355 { .field = "wMixerDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
359 /** Mixer Unit descriptor definitions for the three Audio Device Class protocols */
360 const struct desc * const desc_audio_ac_mixer_unit[3] = {
361 desc_audio_1_ac_mixer_unit,
362 desc_audio_2_ac_mixer_unit,
363 desc_audio_3_ac_mixer_unit,
366 /** Selector Unit bmControls; Human readable bit meanings. */
367 static const char * const uac2_selector_unit_bmcontrols[] = {
372 /** UAC1: 4.3.2.4 Selector Unit Descriptor; Table 4-6. */
373 static const struct desc desc_audio_1_ac_selector_unit[] = {
374 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
375 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
376 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
377 .array = { .array = true, .length_field1 = "bNrInPins" } },
378 { .field = "iSelector", .size = 1, .type = DESC_STR_DESC_INDEX },
382 /** UAC2: 4.7.2.7 Selector Unit Descriptor; Table 4-12. */
383 static const struct desc desc_audio_2_ac_selector_unit[] = {
384 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
385 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
386 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
387 .array = { .array = true, .length_field1 = "bNrInPins" } },
388 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
389 .bmcontrol = uac2_selector_unit_bmcontrols },
390 { .field = "iSelector", .size = 1, .type = DESC_STR_DESC_INDEX },
394 /** UAC3: 4.5.2.6 Selector Unit Descriptor; Table 4-30. */
395 static const struct desc desc_audio_3_ac_selector_unit[] = {
396 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
397 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
398 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
399 .array = { .array = true, .length_field1 = "bNrInPins" } },
400 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
401 .bmcontrol = uac2_selector_unit_bmcontrols },
402 { .field = "wSelectorDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
406 /** Selector Unit descriptor definitions for the three Audio Device Class protocols */
407 const struct desc * const desc_audio_ac_selector_unit[3] = {
408 desc_audio_1_ac_selector_unit,
409 desc_audio_2_ac_selector_unit,
410 desc_audio_3_ac_selector_unit,
413 /** UAC1: Table A-7: Processing Unit Process Types */
414 static const char * const uac1_proc_unit_types[] = {
417 [2] = "Dolby Prologic",
418 [3] = "3D Stereo Extender",
419 [4] = "Reverberation",
421 [6] = "Dyn Range Comp",
425 /** UAC1: Up/Down-mix and Dolby Prologic proc unit descriptor extensions Table 4-9, Table 4-10. */
426 static const struct desc desc_audio_1_ac_proc_unit_extended[] = {
427 { .field = "bNrModes", .size = 1, .type = DESC_NUMBER },
428 { .field = "waModes", .size = 2, .type = DESC_BITMAP,
429 .array = { .array = true, .length_field1 = "bNrModes" } },
433 /** UAC1: Table A-7: Processing Unit Process Types */
434 static const struct desc_ext desc_audio_1_ac_proc_unit_specific[] = {
435 { .type = 1, .desc = desc_audio_1_ac_proc_unit_extended },
436 { .type = 2, .desc = desc_audio_1_ac_proc_unit_extended },
440 /** UAC1: 4.3.2.6 Processing Unit Descriptor; Table 4-8. */
441 static const struct desc desc_audio_1_ac_processing_unit[] = {
442 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
443 { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS,
444 .number_strings = uac1_proc_unit_types },
445 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
446 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
447 .array = { .array = true, .length_field1 = "bNrInPins" } },
448 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
449 { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS,
450 .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } },
451 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
452 { .field = "bControlSize", .size = 1, .type = DESC_NUMBER },
453 { .field = "bmControls", .size = 1, .type = DESC_BITMAP,
454 .array = { .array = true, .length_field1 = "bControlSize" } },
455 { .field = "iProcessing", .size = 1, .type = DESC_STR_DESC_INDEX },
456 { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION,
457 .extension = { .type_field = "wProcessType", .d = desc_audio_1_ac_proc_unit_specific } },
461 /** UAC2: 4.7.2.11.1 Up/Down-mix Processing Unit Descriptor; Table 4-21. */
462 static const struct desc desc_audio_2_ac_proc_unit_up_down_mix[] = {
463 { .field = "bNrModes", .size = 1, .type = DESC_NUMBER },
464 { .field = "daModes", .size = 4, .type = DESC_BITMAP,
465 .array = { .array = true, .length_field1 = "bNrModes" } },
469 /** UAC2: 4.7.2.11.2 Dolby prologic Processing Unit Descriptor; Table 4-22. */
470 static const struct desc desc_audio_2_ac_proc_unit_dolby_prologic[] = {
471 { .field = "bNrModes", .size = 1, .type = DESC_NUMBER },
472 { .field = "daModes", .size = 4, .type = DESC_BITMAP,
473 .array = { .array = true, .length_field1 = "bNrModes" } },
477 /** UAC2: Table A-12: Processing Unit Process Types */
478 static const struct desc_ext desc_audio_2_ac_proc_unit_specific[] = {
479 { .type = 1, .desc = desc_audio_2_ac_proc_unit_up_down_mix },
480 { .type = 2, .desc = desc_audio_2_ac_proc_unit_dolby_prologic },
484 /** UAC2: Table A-12: Processing Unit Process Types */
485 static const char * const uac2_proc_unit_types[] = {
488 [2] = "Dolby Prologic",
489 [3] = "Stereo Extender",
493 /** UAC2: 4.7.2.11 Processing Unit Descriptor; Table 4-20. */
494 static const struct desc desc_audio_2_ac_processing_unit[] = {
495 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
496 { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS,
497 .number_strings = uac2_proc_unit_types },
498 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
499 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
500 .array = { .array = true, .length_field1 = "bNrInPins" } },
501 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
502 { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS,
503 .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } },
504 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
505 { .field = "bmControls", .size = 2, .type = DESC_BITMAP },
506 { .field = "iProcessing", .size = 1, .type = DESC_STR_DESC_INDEX },
507 { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION,
508 .extension = { .type_field = "wProcessType", .d = desc_audio_2_ac_proc_unit_specific } },
512 /** Processor unit Up/Down-mix bmControls; Human readable bit meanings. */
513 static const char * const uac3_proc_unit_up_down_mix_bmcontrols[] = {
520 /** UAC3: 4.5.2.10.1 Up/Down-mix Processing Unit Descriptor; Table 4-39. */
521 static const struct desc desc_audio_3_ac_proc_unit_up_down_mix[] = {
522 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
523 .bmcontrol = uac3_proc_unit_up_down_mix_bmcontrols },
524 { .field = "bNrModes", .size = 1, .type = DESC_NUMBER },
525 { .field = "waClusterDescrID", .size = 2, .type = DESC_NUMBER,
526 .array = { .array = true, .length_field1 = "bNrModes" } },
530 /** Processor unit stereo extender bmControls; Human readable bit meanings. */
531 static const char * const uac3_proc_unit_stereo_extender_bmcontrols[] = {
538 /** UAC3: 4.5.2.10.2 Stereo Extender Processing Unit Descriptor; Table 4-40. */
539 static const struct desc desc_audio_3_ac_proc_unit_stereo_extender[] = {
540 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
541 .bmcontrol = uac3_proc_unit_stereo_extender_bmcontrols },
545 /** UAC3: 4.5.2.10.3 Multi Func Proc Unit Descriptor; Algorithms; Table 4-41. */
546 static const char *uac3_proc_unit_multi_func_algorithms[] = {
547 [0] = "Algorithm Undefined.",
548 [1] = "Beam Forming.",
549 [2] = "Acoustic Echo Cancellation.",
550 [3] = "Active Noise Cancellation.",
551 [4] = "Blind Source Separation.",
552 [5] = "Noise Suppression/Reduction.",
556 /** Processor unit Multi Func bmControls; Human readable bit meanings. */
557 static const char * const uac3_proc_unit_multi_func_bmcontrols[] = {
563 /** UAC3: 4.5.2.10.3 Multi Function Processing Unit Descriptor; Table 4-41. */
564 static const struct desc desc_audio_3_ac_proc_unit_multi_function[] = {
565 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
566 .bmcontrol = uac3_proc_unit_multi_func_bmcontrols },
567 { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER, },
568 { .field = "bmAlgorithms", .size = 4, .type = DESC_BITMAP_STRINGS,
570 .strings = uac3_proc_unit_multi_func_algorithms,
576 /** UAC3: Table A-20: Processing Unit Process Types */
577 static const char * const uac3_proc_unit_types[] = {
580 [2] = "Stereo Extender",
581 [3] = "Multi-Function",
585 /** UAC3: Table A-20: Processing Unit Process Types */
586 static const struct desc_ext desc_audio_3_ac_proc_unit_specific[] = {
587 { .type = 1, .desc = desc_audio_3_ac_proc_unit_up_down_mix },
588 { .type = 2, .desc = desc_audio_3_ac_proc_unit_stereo_extender },
589 { .type = 3, .desc = desc_audio_3_ac_proc_unit_multi_function },
593 /** UAC3: 4.5.2.10 Processing Unit Descriptor; Table 4-38. */
594 static const struct desc desc_audio_3_ac_processing_unit[] = {
595 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
596 { .field = "wProcessType", .size = 2, .type = DESC_NUMBER_STRINGS,
597 .number_strings = uac3_proc_unit_types },
598 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
599 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
600 .array = { .array = true, .length_field1 = "bNrInPins" } },
601 { .field = "wProcessingDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
602 { .field = "Process-specific", .size = 1, .type = DESC_EXTENSION,
603 .extension = { .type_field = "wProcessType", .d = desc_audio_3_ac_proc_unit_specific } },
607 /** Processing Unit descriptor definitions for the three Audio Device Class protocols */
608 const struct desc * const desc_audio_ac_processing_unit[3] = {
609 desc_audio_1_ac_processing_unit,
610 desc_audio_2_ac_processing_unit,
611 desc_audio_3_ac_processing_unit,
614 /** Audio Control Feature Unit bmControls; Human readable bit meanings. */
615 static const char * const uac_feature_unit_bmcontrols[] = {
621 [ 5] = "Graphic Equalizer",
622 [ 6] = "Automatic Gain",
627 [11] = "Input gain pad",
628 [12] = "Phase inverter",
632 /** UAC1: 4.3.2.5 Feature Unit Descriptor; Table 4-7. */
633 static const struct desc desc_audio_1_ac_feature_unit[] = {
634 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
635 { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT },
636 { .field = "bControlSize", .size = 1, .type = DESC_NUMBER },
637 { .field = "bmaControls", .size_field = "bControlSize", .type = DESC_BMCONTROL_1,
638 .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } },
639 { .field = "iFeature", .size = 1, .type = DESC_STR_DESC_INDEX },
643 /** UAC2: 4.7.2.8 Feature Unit Descriptor; Table 4-13. */
644 static const struct desc desc_audio_2_ac_feature_unit[] = {
645 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
646 { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT },
647 { .field = "bmaControls", .size = 4, .type = DESC_BMCONTROL_2,
648 .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } },
649 { .field = "iFeature", .size = 1, .type = DESC_STR_DESC_INDEX },
653 /** UAC3: 4.5.2.7 Feature Unit Descriptor; Table 4-31. */
654 static const struct desc desc_audio_3_ac_feature_unit[] = {
655 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
656 { .field = "bSourceID", .size = 1, .type = DESC_NUMBER },
657 { .field = "bmaControls", .size = 4, .type = DESC_BMCONTROL_2,
658 .bmcontrol = uac_feature_unit_bmcontrols, .array = { .array = true } },
659 { .field = "wFeatureDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
663 /** Feature Unit descriptor definitions for the three Audio Device Class protocols */
664 const struct desc * const desc_audio_ac_feature_unit[3] = {
665 desc_audio_1_ac_feature_unit,
666 desc_audio_2_ac_feature_unit,
667 desc_audio_3_ac_feature_unit,
670 /** UAC2 Extension Unit bmControls; Human readable bit meanings. */
671 static const char * const uac2_extension_unit_bmcontrols[] = {
679 /** UAC3 Extension Unit bmControls; Human readable bit meanings. */
680 static const char * const uac3_extension_unit_bmcontrols[] = {
686 /** UAC1: 4.3.2.7 Extension Unit Descriptor; Table 4-15. */
687 static const struct desc desc_audio_1_ac_extension_unit[] = {
688 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
689 { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT },
690 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
691 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
692 .array = { .array = true, .length_field1 = "bNrInPins" } },
693 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
694 { .field = "wChannelConfig", .size = 2, .type = DESC_BITMAP_STRINGS,
695 .bitmap_strings = { .strings = uac1_channel_names, .count = 12 } },
696 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
697 { .field = "bControlSize", .size = 1, .type = DESC_NUMBER },
698 { .field = "bmControls", .size = 1, .type = DESC_BITMAP,
699 .array = { .array = true, .length_field1 = "bControlSize" } },
700 { .field = "iExtension", .size = 1, .type = DESC_STR_DESC_INDEX },
704 /** UAC2: 4.7.2.12 Extension Unit Descriptor; Table 4-24. */
705 static const struct desc desc_audio_2_ac_extension_unit[] = {
706 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
707 { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT },
708 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
709 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
710 .array = { .array = true, .length_field1 = "bNrInPins" } },
711 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
712 { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS,
713 .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } },
714 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
715 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
716 .bmcontrol = uac2_extension_unit_bmcontrols },
717 { .field = "iExtension", .size = 1, .type = DESC_STR_DESC_INDEX },
721 /** UAC3: 4.5.2.11 Extension Unit Descriptor; Table 4-42. */
722 static const struct desc desc_audio_3_ac_extension_unit[] = {
723 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
724 { .field = "wExtensionCode", .size = 2, .type = DESC_CONSTANT },
725 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
726 { .field = "baSourceID", .size = 1, .type = DESC_NUMBER,
727 .array = { .array = true, .length_field1 = "bNrInPins" } },
728 { .field = "wExtensionDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
729 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
730 .bmcontrol = uac3_extension_unit_bmcontrols },
731 { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER },
735 /** Extension Unit descriptor definitions for the three Audio Device Class protocols */
736 const struct desc * const desc_audio_ac_extension_unit[3] = {
737 desc_audio_1_ac_extension_unit,
738 desc_audio_2_ac_extension_unit,
739 desc_audio_3_ac_extension_unit,
742 /** UAC2 Clock Source bmControls; Human readable bit meanings. */
743 static const char * const uac2_clock_source_bmcontrols[] = {
744 [0] = "Clock Frequency",
745 [1] = "Clock Validity",
749 static const char * const uac2_clk_src_bmattr[] = {
751 [1] = "Internal fixed",
752 [2] = "Internal variable",
753 [3] = "Internal programmable"
756 static const char * const uac3_clk_src_bmattr[] = {
759 [2] = "(asynchronous)",
760 [3] = "(synchronized to SOF)"
763 /** Special rendering function for UAC2 clock source bmAttributes */
764 static void desc_snowflake_dump_uac2_clk_src_bmattr(
765 unsigned long long value,
768 printf(" %s clock %s\n",
769 uac2_clk_src_bmattr[value & 0x3],
770 (value & 0x4) ? uac3_clk_src_bmattr[3] : "");
773 /** Special rendering function for UAC3 clock source bmAttributes */
774 static void desc_snowflake_dump_uac3_clk_src_bmattr(
775 unsigned long long value,
778 printf(" %s clock %s\n",
779 uac3_clk_src_bmattr[(value & 0x1)],
780 uac3_clk_src_bmattr[0x2 | ((value & 0x2) >> 1)]);
783 /** UAC2: 4.7.2.1 Clock Source Descriptor; Table 4-6. */
784 static const struct desc desc_audio_2_ac_clock_source[] = {
785 { .field = "bClockID", .size = 1, .type = DESC_CONSTANT },
786 { .field = "bmAttributes", .size = 1, .type = DESC_SNOWFLAKE,
787 .snowflake = desc_snowflake_dump_uac2_clk_src_bmattr },
788 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
789 .bmcontrol = uac2_clock_source_bmcontrols },
790 { .field = "bAssocTerminal", .size = 1, .type = DESC_CONSTANT },
791 { .field = "iClockSource", .size = 1, .type = DESC_STR_DESC_INDEX },
795 /** UAC3: 4.5.2.12 Clock Source Descriptor; Table 4-43. */
796 static const struct desc desc_audio_3_ac_clock_source[] = {
797 { .field = "bClockID", .size = 1, .type = DESC_NUMBER },
798 { .field = "bmAttributes", .size = 1, .type = DESC_SNOWFLAKE,
799 .snowflake = desc_snowflake_dump_uac3_clk_src_bmattr },
800 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
801 .bmcontrol = uac2_clock_source_bmcontrols },
802 { .field = "bReferenceTerminal", .size = 1, .type = DESC_NUMBER },
803 { .field = "wClockSourceStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
807 /** Clock Source descriptor definitions for the three Audio Device Class protocols */
808 const struct desc * const desc_audio_ac_clock_source[3] = {
809 NULL, /* UAC1 not supported */
810 desc_audio_2_ac_clock_source,
811 desc_audio_3_ac_clock_source,
814 /** UAC2 Clock Selector bmControls; Human readable bit meanings. */
815 static const char * const uac2_clock_selector_bmcontrols[] = {
816 [0] = "Clock Selector",
820 /** UAC2: 4.7.2.2 Clock Selector Descriptor; Table 4-7. */
821 static const struct desc desc_audio_2_ac_clock_selector[] = {
822 { .field = "bClockID", .size = 1, .type = DESC_NUMBER },
823 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
824 { .field = "baCSourceID", .size = 1, .type = DESC_NUMBER,
825 .array = { .array = true, .length_field1 = "bNrInPins" } },
826 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
827 .bmcontrol = uac2_clock_selector_bmcontrols },
828 { .field = "iClockSelector", .size = 1, .type = DESC_STR_DESC_INDEX },
832 /** UAC3: 4.5.2.13 Clock Selector Descriptor; Table 4-44. */
833 static const struct desc desc_audio_3_ac_clock_selector[] = {
834 { .field = "bClockID", .size = 1, .type = DESC_NUMBER },
835 { .field = "bNrInPins", .size = 1, .type = DESC_NUMBER },
836 { .field = "baCSourceID", .size = 1, .type = DESC_NUMBER,
837 .array = { .array = true, .length_field1 = "bNrInPins" } },
838 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
839 .bmcontrol = uac2_clock_selector_bmcontrols },
840 { .field = "wCSelectorDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
844 /** Clock Selector descriptor definitions for the three Audio Device Class protocols */
845 const struct desc * const desc_audio_ac_clock_selector[3] = {
846 NULL, /* UAC1 not supported */
847 desc_audio_2_ac_clock_selector,
848 desc_audio_3_ac_clock_selector,
851 /** UAC2 Clock Multiplier bmControls; Human readable bit meanings. */
852 static const char * const uac2_clock_multiplier_bmcontrols[] = {
853 [0] = "Clock Numerator",
854 [1] = "Clock Denominator",
858 /** UAC2: 4.7.2.3 Clock Multiplier Descriptor; Table 4-8. */
859 static const struct desc desc_audio_2_ac_clock_multiplier[] = {
860 { .field = "bClockID", .size = 1, .type = DESC_CONSTANT },
861 { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER },
862 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
863 .bmcontrol = uac2_clock_multiplier_bmcontrols },
864 { .field = "iClockMultiplier", .size = 1, .type = DESC_STR_DESC_INDEX },
868 /** UAC3: 4.5.2.14 Clock Multiplier Descriptor; Table 4-45. */
869 static const struct desc desc_audio_3_ac_clock_multiplier[] = {
870 { .field = "bClockID", .size = 1, .type = DESC_NUMBER },
871 { .field = "bCSourceID", .size = 1, .type = DESC_NUMBER },
872 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
873 .bmcontrol = uac2_clock_multiplier_bmcontrols },
874 { .field = "wCMultiplierDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
878 /** Clock Multiplier descriptor definitions for the three Audio Device Class protocols */
879 const struct desc * const desc_audio_ac_clock_multiplier[3] = {
880 NULL, /* UAC1 not supported */
881 desc_audio_2_ac_clock_multiplier,
882 desc_audio_3_ac_clock_multiplier,
885 /** UAC2: 4.7.2.9 Sampling Rate Converter Descriptor; Table 4-14. */
886 static const struct desc desc_audio_2_ac_sample_rate_converter[] = {
887 { .field = "bUnitID", .size = 1, .type = DESC_CONSTANT },
888 { .field = "bSourceID", .size = 1, .type = DESC_CONSTANT },
889 { .field = "bCSourceInID", .size = 1, .type = DESC_CONSTANT },
890 { .field = "bCSourceOutID", .size = 1, .type = DESC_CONSTANT },
891 { .field = "iSRC", .size = 1, .type = DESC_STR_DESC_INDEX },
895 /** UAC3: 4.5.2.8 Sampling Rate Converter Descriptor; Table 4-32. */
896 static const struct desc desc_audio_3_ac_sample_rate_converter[] = {
897 { .field = "bUnitID", .size = 1, .type = DESC_NUMBER },
898 { .field = "bSourceID", .size = 1, .type = DESC_NUMBER },
899 { .field = "bCSourceInID", .size = 1, .type = DESC_NUMBER },
900 { .field = "bCSourceOutID", .size = 1, .type = DESC_NUMBER },
901 { .field = "wSRCDescrStr", .size = 2, .type = DESC_CS_STR_DESC_ID },
905 /** Sample Rate Converter descriptor definitions for the three Audio Device Class protocols */
906 const struct desc * const desc_audio_ac_sample_rate_converter[3] = {
907 NULL, /* UAC1 not supported */
908 desc_audio_2_ac_sample_rate_converter,
909 desc_audio_3_ac_sample_rate_converter,
912 /** UAC2 AudioStreaming Interface bmControls; Human readable bit meanings. */
913 static const char * const uac2_as_interface_bmcontrols[] = {
914 [0] = "Active Alternate Setting",
915 [1] = "Valid Alternate Setting",
919 /** UAC3 AudioStreaming Interface bmControls; Human readable bit meanings. */
920 static const char * const uac3_as_interface_bmcontrols[] = {
921 [0] = "Active Alternate Setting",
922 [1] = "Valid Alternate Setting",
923 [2] = "Audio Data Format Control",
927 /* wFormatTag hex prefix for format type */
928 #define UAC_FORMAT_TYPE_I 0x0
929 #define UAC_FORMAT_TYPE_II 0x1
930 #define UAC_FORMAT_TYPE_III 0x2
932 /** Format type I codes; Human-readable values. */
933 static const char * const audio_data_format_type_i[] = {
934 [0] = "TYPE_I_UNDEFINED",
942 /** Format type II codes; Human-readable values. */
943 static const char * const audio_data_format_type_ii[] = {
944 [0] = "TYPE_II_UNDEFINED",
949 /** Format type III codes; Human-readable values. */
950 static const char * const audio_data_format_type_iii[] = {
951 [0] = "TYPE_III_UNDEFINED",
952 [1] = "IEC1937_AC-3",
953 [2] = "IEC1937_MPEG-1_Layer1",
954 [3] = "IEC1937_MPEG-Layer2/3/NOEXT",
955 [4] = "IEC1937_MPEG-2_EXT",
956 [5] = "IEC1937_MPEG-2_Layer1_LS",
957 [6] = "IEC1937_MPEG-2_Layer2/3_LS"
960 /** Special rendering function for UAC1 AS interface wFormatTag */
961 static void desc_snowflake_dump_uac1_as_interface_wformattag(
962 unsigned long long value,
965 const char *format_string = "undefined";
967 /* Format codes are 0xTNNN, where T=Type prefix, NNN = format code. */
969 if (value <= ((UAC_FORMAT_TYPE_I << 12) +
970 ARRAY_LEN(audio_data_format_type_i))) {
971 format_string = audio_data_format_type_i[value];
973 } else if ((value >= (UAC_FORMAT_TYPE_II << 12)) &&
974 (value <= ((UAC_FORMAT_TYPE_II << 12) +
975 ARRAY_LEN(audio_data_format_type_ii)))) {
976 format_string = audio_data_format_type_ii[value & 0xfff];
978 } else if ((value >= (UAC_FORMAT_TYPE_III << 12)) &&
979 (value <= ((UAC_FORMAT_TYPE_III << 12) +
980 ARRAY_LEN(audio_data_format_type_iii)))) {
981 format_string = audio_data_format_type_iii[value & 0xfff];
984 printf(" %s\n", format_string);
987 /** Special rendering function for UAC2 AS interface bmFormats */
988 static void desc_snowflake_dump_uac2_as_interface_bmformats(
989 unsigned long long value,
995 for (i = 0; i < 5; i++) {
996 if ((value >> i) & 0x1) {
997 printf("%*s%s\n", indent * 2, "",
998 audio_data_format_type_i[i + 1]);
1004 /** UAC1: 4.5.2 Class-Specific AS Interface Descriptor; Table 4-19. */
1005 static const struct desc desc_audio_1_as_interface[] = {
1006 { .field = "bTerminalLink", .size = 1, .type = DESC_CONSTANT },
1007 { .field = "bDelay", .size = 1, .type = DESC_NUMBER_POSTFIX,
1008 .number_postfix = " frames" },
1009 { .field = "wFormatTag", .size = 2, .type = DESC_SNOWFLAKE,
1010 .snowflake = desc_snowflake_dump_uac1_as_interface_wformattag },
1014 /** UAC2: 4.9.2 Class-Specific AS Interface Descriptor; Table 4-27. */
1015 static const struct desc desc_audio_2_as_interface[] = {
1016 { .field = "bTerminalLink", .size = 1, .type = DESC_NUMBER },
1017 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
1018 .bmcontrol = uac2_as_interface_bmcontrols },
1019 { .field = "bFormatType", .size = 1, .type = DESC_CONSTANT },
1020 { .field = "bmFormats", .size = 4, .type = DESC_SNOWFLAKE,
1021 .snowflake = desc_snowflake_dump_uac2_as_interface_bmformats },
1022 { .field = "bNrChannels", .size = 1, .type = DESC_NUMBER },
1023 { .field = "bmChannelConfig", .size = 4, .type = DESC_BITMAP_STRINGS,
1024 .bitmap_strings = { .strings = uac2_channel_names, .count = 26 } },
1025 { .field = "iChannelNames", .size = 1, .type = DESC_STR_DESC_INDEX },
1029 /** UAC3: 4.7.2 Class-Specific AS Interface Descriptor; Table 4-49. */
1030 static const struct desc desc_audio_3_as_interface[] = {
1031 { .field = "bTerminalLink", .size = 1, .type = DESC_NUMBER },
1032 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
1033 .bmcontrol = uac3_as_interface_bmcontrols },
1034 { .field = "wClusterDescrID", .size = 2, .type = DESC_NUMBER },
1035 { .field = "bmFormats", .size = 8, .type = DESC_BITMAP },
1036 { .field = "bSubslotSize", .size = 1, .type = DESC_NUMBER },
1037 { .field = "bBitResolution", .size = 1, .type = DESC_NUMBER },
1038 { .field = "bmAuxProtocols", .size = 2, .type = DESC_BITMAP },
1039 { .field = "bControlSize", .size = 1, .type = DESC_NUMBER },
1043 /** AudioStreaming Interface descriptor definitions for the three Audio Device Class protocols */
1044 const struct desc * const desc_audio_as_interface[3] = {
1045 desc_audio_1_as_interface,
1046 desc_audio_2_as_interface,
1047 desc_audio_3_as_interface,
1050 /** UAC1: Data Endpoint bmAttributes; Human readable bit meanings. */
1051 static const char * const uac1_as_endpoint_bmattributes[] = {
1052 [0] = "Sampling Frequency",
1054 [2] = "Audio Data Format Control",
1055 [7] = "MaxPacketsOnly"
1058 /** UAC2: Data Endpoint bmAttributes; Human readable bit meanings. */
1059 static const char * const uac2_as_endpoint_bmattributes[] = {
1060 [7] = "MaxPacketsOnly",
1063 /** UAC2 AudioStreaming Interface bmControls; Human readable bit meanings. */
1064 static const char * const uac2_as_isochronous_audio_data_endpoint_bmcontrols[] = {
1066 [1] = "Data Overrun",
1067 [2] = "Data Underrun",
1071 /** Audio Data Endpoint bLockDelayUnits; Human readable value meanings. */
1072 static const char * const uac_as_isochronous_audio_data_endpoint_blockdelayunits[] = {
1074 [1] = "Milliseconds",
1075 [2] = "Decoded PCM samples",
1079 /** UAC1: 4.6.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-21. */
1080 static const struct desc desc_audio_1_as_isochronous_audio_data_endpoint[] = {
1081 { .field = "bmAttributes", .size = 1, .type = DESC_BITMAP_STRINGS,
1082 .bitmap_strings = { .strings = uac1_as_endpoint_bmattributes, .count = 8 } },
1083 { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS,
1084 .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits },
1085 { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER },
1089 /** UAC2: 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-34. */
1090 static const struct desc desc_audio_2_as_isochronous_audio_data_endpoint[] = {
1091 { .field = "bmAttributes", .size = 1, .type = DESC_BITMAP_STRINGS,
1092 .bitmap_strings = { .strings = uac2_as_endpoint_bmattributes, .count = 8 } },
1093 { .field = "bmControls", .size = 1, .type = DESC_BMCONTROL_2,
1094 .bmcontrol = uac2_as_isochronous_audio_data_endpoint_bmcontrols },
1095 { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS,
1096 .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits },
1097 { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER },
1101 /** UAC3: 4.8.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor; Table 4-52. */
1102 static const struct desc desc_audio_3_as_isochronous_audio_data_endpoint[] = {
1103 { .field = "bmControls", .size = 4, .type = DESC_BMCONTROL_2,
1104 .bmcontrol = uac2_as_isochronous_audio_data_endpoint_bmcontrols },
1105 { .field = "bLockDelayUnits", .size = 1, .type = DESC_NUMBER_STRINGS,
1106 .number_strings = uac_as_isochronous_audio_data_endpoint_blockdelayunits },
1107 { .field = "wLockDelay", .size = 2, .type = DESC_NUMBER },
1111 /** Isochronous Audio Data Endpoint descriptor definitions for the three Audio Device Class protocols */
1112 const struct desc * const desc_audio_as_isochronous_audio_data_endpoint[3] = {
1113 desc_audio_1_as_isochronous_audio_data_endpoint,
1114 desc_audio_2_as_isochronous_audio_data_endpoint,
1115 desc_audio_3_as_isochronous_audio_data_endpoint,
1118 /** USB3: 9.6.2.7 Configuration Summary Descriptor; Table 9-21. */
1119 const struct desc desc_usb3_dc_configuration_summary[] = {
1120 { .field = "bLength", .size = 1, .type = DESC_NUMBER },
1121 { .field = "bDescriptorType", .size = 1, .type = DESC_CONSTANT },
1122 { .field = "bDevCapabilityType", .size = 1, .type = DESC_NUMBER },
1123 { .field = "bcdVersion", .size = 2, .type = DESC_BCD },
1124 { .field = "bClass", .size = 1, .type = DESC_NUMBER },
1125 { .field = "bSubClass", .size = 1, .type = DESC_NUMBER },
1126 { .field = "bProtocol", .size = 1, .type = DESC_NUMBER },
1127 { .field = "bConfigurationCount", .size = 1, .type = DESC_NUMBER },
1128 { .field = "bConfigurationIndex", .size = 1, .type = DESC_NUMBER,
1129 .array = { .array = true, .length_field1 = "bConfigurationCount" } },