2 * Originally released under the Be Sample Code License.
3 * Copyright 2000, Be Incorporated. All rights reserved.
5 * Modified for Haiku by François Revol and Michael Lotz.
6 * Copyright 2007-2016, Haiku Inc. All rights reserved.
13 #include <usb/USB_audio.h>
14 #include <usb/USB_midi.h>
19 DumpAudioCSInterfaceDescriptorHeader(
20 const usb_audiocontrol_header_descriptor
* descriptor
)
22 printf(" Type .............. 0x%02x\n",
23 descriptor
->descriptor_type
);
24 printf(" Subtype ........... 0x%02x (Header)\n",
25 descriptor
->descriptor_subtype
);
26 printf(" ADC Release ....... %d.%d\n",
27 descriptor
->bcd_release_no
>> 8, descriptor
->bcd_release_no
& 0xFF);
28 printf(" Total Length ...... %u\n",
29 descriptor
->r1
.total_length
);
30 printf(" Interfaces ........ ");
32 for (uint8 i
= 0; i
< descriptor
->r1
.in_collection
; i
++)
33 printf("%u, ", descriptor
->r1
.interface_numbers
[i
]);
39 DumpChannelConfig(uint32 wChannelConfig
)
45 { "Front .......... ", B_CHANNEL_LEFT
| B_CHANNEL_RIGHT
47 { "L.F.E .......... ", B_CHANNEL_SUB
},
48 { "Back ........... ", B_CHANNEL_REARLEFT
| B_CHANNEL_REARRIGHT
49 | B_CHANNEL_BACK_CENTER
},
50 { "Center ......... ", B_CHANNEL_FRONT_LEFT_CENTER
51 | B_CHANNEL_FRONT_RIGHT_CENTER
},
52 { "Side ........... ", B_CHANNEL_SIDE_LEFT
| B_CHANNEL_SIDE_RIGHT
},
53 { "Top ............ ", B_CHANNEL_TOP_CENTER
},
54 { "Top Front ...... ", B_CHANNEL_TOP_FRONT_LEFT
55 | B_CHANNEL_TOP_FRONT_CENTER
| B_CHANNEL_TOP_FRONT_RIGHT
},
56 { "Top Back ....... ", B_CHANNEL_TOP_BACK_LEFT
57 | B_CHANNEL_TOP_BACK_CENTER
| B_CHANNEL_TOP_BACK_RIGHT
}
60 struct _Entry aChannels
[] = {
61 { "Left", B_CHANNEL_LEFT
| B_CHANNEL_FRONT_LEFT_CENTER
62 | B_CHANNEL_REARLEFT
| B_CHANNEL_SIDE_LEFT
| B_CHANNEL_TOP_BACK_LEFT
63 | B_CHANNEL_TOP_FRONT_LEFT
},
64 { "Right", B_CHANNEL_FRONT_RIGHT_CENTER
| B_CHANNEL_TOP_FRONT_RIGHT
65 | B_CHANNEL_REARRIGHT
| B_CHANNEL_RIGHT
| B_CHANNEL_SIDE_RIGHT
66 | B_CHANNEL_TOP_BACK_RIGHT
},
67 { "Center", B_CHANNEL_BACK_CENTER
| B_CHANNEL_CENTER
68 | B_CHANNEL_TOP_BACK_CENTER
| B_CHANNEL_TOP_CENTER
69 | B_CHANNEL_TOP_FRONT_CENTER
},
70 { "L.F.E.", B_CHANNEL_SUB
}
73 for (size_t i
= 0; i
< sizeof(aClusters
) / sizeof(aClusters
[0]); i
++) {
74 uint32 mask
= aClusters
[i
].mask
& wChannelConfig
;
76 printf(" %s", aClusters
[i
].name
);
77 for (size_t j
= 0; j
< sizeof(aChannels
) / sizeof(aChannels
[0]); j
++)
78 if ((aChannels
[j
].mask
& mask
) != 0)
79 printf("%s ", aChannels
[j
].name
);
87 TerminalTypeName(uint16 terminalType
)
89 switch (terminalType
) {
90 case USB_AUDIO_UNDEFINED_USB_IO
:
91 return "USB Undefined";
92 case USB_AUDIO_STREAMING_USB_IO
:
93 return "USB Streaming";
94 case USB_AUDIO_VENDOR_USB_IO
:
95 return "USB vendor specific";
97 case USB_AUDIO_UNDEFINED_IN
:
99 case USB_AUDIO_MICROPHONE_IN
:
101 case USB_AUDIO_DESKTOPMIC_IN
:
102 return "Desktop microphone";
103 case USB_AUDIO_PERSONALMIC_IN
:
104 return "Personal microphone";
105 case USB_AUDIO_OMNI_MIC_IN
:
106 return "Omni-directional microphone";
107 case USB_AUDIO_MICS_ARRAY_IN
:
108 return "Microphone array";
109 case USB_AUDIO_PROC_MICS_ARRAY_IN
:
110 return "Processing microphone array";
111 case USB_AUDIO_LINE_CONNECTOR_IO
:
113 case USB_AUDIO_SPDIF_INTERFACE_IO
:
116 case USB_AUDIO_UNDEFINED_OUT
:
118 case USB_AUDIO_SPEAKER_OUT
:
120 case USB_AUDIO_HEAD_PHONES_OUT
:
122 case USB_AUDIO_HMD_AUDIO_OUT
:
123 return "Head Mounted Display Audio";
124 case USB_AUDIO_DESKTOP_SPEAKER
:
125 return "Desktop speaker";
126 case USB_AUDIO_ROOM_SPEAKER
:
127 return "Room speaker";
128 case USB_AUDIO_COMM_SPEAKER
:
129 return "Communication speaker";
130 case USB_AUDIO_LFE_SPEAKER
:
131 return "Low frequency effects speaker";
140 DumpAudioCSInterfaceDescriptorInputTerminal(
141 const usb_audio_input_terminal_descriptor
* descriptor
)
143 printf(" Type .............. 0x%02x\n",
144 descriptor
->descriptor_type
);
145 printf(" Subtype ........... 0x%02x (Input Terminal)\n",
146 descriptor
->descriptor_subtype
);
147 printf(" Terminal ID ....... %u\n",
148 descriptor
->terminal_id
);
149 printf(" Terminal Type ..... 0x%04x (%s)\n",
150 descriptor
->terminal_type
,
151 TerminalTypeName(descriptor
->terminal_type
));
152 printf(" Associated Terminal %u\n",
153 descriptor
->assoc_terminal
);
154 printf(" Nr Channels ....... %u\n",
155 descriptor
->r1
.num_channels
);
156 printf(" Channel Config .... 0x%x\n",
157 descriptor
->r1
.channel_config
);
158 DumpChannelConfig(descriptor
->r1
.channel_config
);
160 printf(" Channel Names ..... %u\n",
161 descriptor
->r1
.channel_names
);
162 printf(" Terminal .......... %u\n",
163 descriptor
->r1
.terminal
);
168 DumpAudioCSInterfaceDescriptorOutputTerminal(
169 const usb_audio_output_terminal_descriptor
* descriptor
)
171 printf(" Type .............. 0x%02x\n",
172 descriptor
->descriptor_type
);
173 printf(" Subtype ........... 0x%02x (Output Terminal)\n",
174 descriptor
->descriptor_subtype
);
175 printf(" Terminal ID ....... %u\n",
176 descriptor
->terminal_id
);
177 printf(" Terminal Type ..... 0x%04x (%s)\n",
178 descriptor
->terminal_type
,
179 TerminalTypeName(descriptor
->terminal_type
));
180 printf(" Associated Terminal %u\n",
181 descriptor
->assoc_terminal
);
182 printf(" Source ID ......... %u\n",
183 descriptor
->source_id
);
184 printf(" Terminal .......... %u\n",
185 descriptor
->r1
.terminal
);
190 DumpAudioCSInterfaceDescriptorMixerUnit(
191 const usb_audio_mixer_unit_descriptor
* descriptor
)
193 printf(" Type .............. 0x%02x\n",
194 descriptor
->descriptor_type
);
195 printf(" Subtype ........... 0x%02x (Mixer Unit)\n",
196 descriptor
->descriptor_subtype
);
197 printf(" Unit ID ........... %u\n",
198 descriptor
->unit_id
);
200 printf(" Source IDs ........ ");
201 for (uint8 i
= 0; i
< descriptor
->num_input_pins
; i
++)
202 printf("%u, ", descriptor
->input_pins
[i
]);
205 usb_audio_output_channels_descriptor_r1
* channels
206 = (usb_audio_output_channels_descriptor_r1
*)
207 &descriptor
->input_pins
[descriptor
->num_input_pins
];
209 printf(" Channels .......... %u\n",
210 channels
->num_output_pins
);
211 printf(" Channel Config .... 0x%x\n",
212 channels
->channel_config
);
213 DumpChannelConfig(channels
->channel_config
);
214 printf(" Channel Names ..... %u\n",
215 channels
->channel_names
);
217 usb_generic_descriptor
* generic
= (usb_generic_descriptor
*)descriptor
;
218 uint8 idx
= 7 + descriptor
->num_input_pins
;
219 printf(" Bitmap Control .... 0x");
220 for (uint i
= 1; idx
< descriptor
->length
- 3; idx
++, i
++)
221 printf("%02x ", (uint8
)generic
->data
[idx
]);
224 printf(" Mixer ............. %u\n",
225 generic
->data
[generic
->length
- 3]);
230 DumpAudioCSInterfaceDescriptorSelectorUnit(
231 const usb_audio_selector_unit_descriptor
* descriptor
)
233 printf(" Type .............. 0x%02x\n",
234 descriptor
->descriptor_type
);
235 printf(" Subtype ........... 0x%02x (Selector Unit)\n",
236 descriptor
->descriptor_subtype
);
237 printf(" Unit ID ........... %u\n",
238 descriptor
->unit_id
);
240 printf(" Source IDs ........ ");
241 for (uint8 i
= 0; i
< descriptor
->num_input_pins
; i
++)
242 printf("%u, ", descriptor
->input_pins
[i
]);
245 usb_generic_descriptor
* generic
= (usb_generic_descriptor
*)descriptor
;
246 printf(" Selector .......... %u\n",
247 (uint8
)generic
->data
[descriptor
->num_input_pins
+ 2]);
252 DumpBMAControl(uint8 channel
, uint32 bma
)
254 const char* BMAControls
[] = {
271 printf(" Master Channel . ");
273 printf(" Channel %u ...... ", channel
);
277 i
< sizeof(BMAControls
) / sizeof(BMAControls
[0]); i
++, mask
<<= 1)
279 printf("%s ", BMAControls
[i
]);
285 DumpAudioCSInterfaceDescriptorFeatureUnit(
286 const usb_audio_feature_unit_descriptor
* descriptor
)
288 printf(" Type .............. 0x%02x\n",
289 descriptor
->descriptor_type
);
290 printf(" Subtype ........... 0x%02x (Feature Unit)\n",
291 descriptor
->descriptor_subtype
);
292 printf(" Unit ID ........... %u\n",
293 descriptor
->unit_id
);
294 printf(" Source ID ......... %u\n",
295 descriptor
->source_id
);
297 printf(" Control Size ...... %u\n",
298 descriptor
->r1
.control_size
);
301 uint8 channels
= (descriptor
->length
- 6) / descriptor
->r1
.control_size
;
302 for (uint8 i
= 0; i
< channels
; i
++) {
303 switch (descriptor
->r1
.control_size
) {
305 DumpBMAControl(i
, descriptor
->r1
.bma_controls
[i
]);
308 DumpBMAControl(i
, *(uint16
*)&descriptor
->r1
.bma_controls
[i
* 2]);
311 DumpBMAControl(i
, *(uint32
*)&descriptor
->r1
.bma_controls
[i
* 4]);
314 printf(" BMA Channel %u ... ", i
);
315 for (uint8 j
= 0; j
< descriptor
->r1
.control_size
; j
++)
316 printf("%02x ", descriptor
->r1
.bma_controls
[i
+ j
]);
321 usb_generic_descriptor
* generic
= (usb_generic_descriptor
*)descriptor
;
322 printf(" Feature ........... %u\n",
323 (uint8
)generic
->data
[descriptor
->length
- 3]);
328 DumpAudioCSInterfaceDescriptorAssociated(
329 const usb_generic_descriptor
* descriptor
)
331 printf(" Type .............. 0x%02x\n",
332 descriptor
->descriptor_type
);
333 printf(" Subtype ........... 0x%02x (Associate Interface)\n",
334 (uint8
)descriptor
->data
[0]);
335 printf(" Interface ......... %u\n",
336 (uint8
)descriptor
->data
[1]);
338 printf(" Data .............. ");
339 for (uint8 i
= 0; i
< descriptor
->length
- 2; i
++)
340 printf("%02x ", descriptor
->data
[i
]);
346 DumpAudioControlCSInterfaceDescriptor(const usb_generic_descriptor
* descriptor
)
348 uint8 descriptorSubtype
= descriptor
->data
[0];
349 switch (descriptorSubtype
) {
350 case USB_AUDIO_AC_HEADER
:
351 DumpAudioCSInterfaceDescriptorHeader(
352 (usb_audiocontrol_header_descriptor
*)descriptor
);
354 case USB_AUDIO_AC_INPUT_TERMINAL
:
355 DumpAudioCSInterfaceDescriptorInputTerminal(
356 (usb_audio_input_terminal_descriptor
*)descriptor
);
358 case USB_AUDIO_AC_OUTPUT_TERMINAL
:
359 DumpAudioCSInterfaceDescriptorOutputTerminal(
360 (usb_audio_output_terminal_descriptor
*)descriptor
);
362 case USB_AUDIO_AC_MIXER_UNIT
:
363 DumpAudioCSInterfaceDescriptorMixerUnit(
364 (usb_audio_mixer_unit_descriptor
*)descriptor
);
366 case USB_AUDIO_AC_SELECTOR_UNIT
:
367 DumpAudioCSInterfaceDescriptorSelectorUnit(
368 (usb_audio_selector_unit_descriptor
*)descriptor
);
370 case USB_AUDIO_AC_FEATURE_UNIT
:
371 DumpAudioCSInterfaceDescriptorFeatureUnit(
372 (usb_audio_feature_unit_descriptor
*)descriptor
);
374 case USB_AUDIO_AC_EXTENSION_UNIT
:
375 DumpAudioCSInterfaceDescriptorAssociated(descriptor
);
378 DumpDescriptorData(descriptor
);
384 DumpGeneralASInterfaceDescriptor(
385 const usb_audio_streaming_interface_descriptor
* descriptor
)
387 printf(" Subtype ........... %u (AS_GENERAL)\n",
388 descriptor
->descriptor_subtype
);
389 printf(" Terminal link ..... %u\n",
390 descriptor
->terminal_link
);
391 printf(" Delay ............. %u\n",
392 descriptor
->r1
.delay
);
393 printf(" Format tag ........ %u\n",
394 descriptor
->r1
.format_tag
);
399 GetSamplingFrequency(const usb_audio_sampling_freq
& freq
)
401 return freq
.bytes
[0] | freq
.bytes
[1] << 8 | freq
.bytes
[2] << 16;
406 DumpSamplingFrequencies(uint8 type
, const usb_audio_sampling_freq
* freqs
)
409 printf(" Sampling Freq ..... ");
410 for (uint8 i
= 0; i
< type
; i
++)
411 printf("%" B_PRIu32
", ", GetSamplingFrequency(freqs
[i
]));
414 printf(" Sampling Freq ..... %" B_PRIu32
" to %"
415 B_PRIu32
"\n", GetSamplingFrequency(freqs
[0]),
416 GetSamplingFrequency(freqs
[1]));
422 DumpASFormatTypeI(const usb_audio_format_descriptor
* descriptor
)
424 printf(" Subtype ........... %u (FORMAT_TYPE)\n",
425 descriptor
->descriptor_subtype
);
426 printf(" Format Type ....... %u (FORMAT_TYPE_I)\n",
427 descriptor
->format_type
);
428 printf(" Channels .......... %u\n",
429 descriptor
->typeI
.nr_channels
);
430 printf(" Subframe size ..... %u\n",
431 descriptor
->typeI
.subframe_size
);
432 printf(" Bit resoultion .... %u\n",
433 descriptor
->typeI
.bit_resolution
);
435 DumpSamplingFrequencies(descriptor
->typeI
.sam_freq_type
,
436 descriptor
->typeI
.sam_freqs
);
441 DumpASFormatTypeIII(const usb_audio_format_descriptor
* descriptor
)
443 printf(" Subtype ........... %u (FORMAT_TYPE)\n",
444 descriptor
->descriptor_subtype
);
445 printf(" Format Type ....... %u (FORMAT_TYPE_III)\n",
446 descriptor
->format_type
);
447 printf(" Channels .......... %u\n",
448 descriptor
->typeIII
.nr_channels
);
449 printf(" Subframe size ..... %u\n",
450 descriptor
->typeIII
.subframe_size
);
451 printf(" Bit resoultion .... %u\n",
452 descriptor
->typeIII
.bit_resolution
);
454 DumpSamplingFrequencies(descriptor
->typeIII
.sam_freq_type
,
455 descriptor
->typeIII
.sam_freqs
);
460 DumpASFormatTypeII(const usb_audio_format_descriptor
* descriptor
)
462 printf(" Subtype ........... %u (FORMAT_TYPE)\n",
463 descriptor
->descriptor_subtype
);
464 printf(" Format Type ....... %u (FORMAT_TYPE_II)\n",
465 descriptor
->format_type
);
466 printf(" Max Bitrate ....... %u\n",
467 descriptor
->typeII
.max_bit_rate
);
468 printf(" Samples per Frame . %u\n",
469 descriptor
->typeII
.samples_per_frame
);
471 DumpSamplingFrequencies(descriptor
->typeII
.sam_freq_type
,
472 descriptor
->typeII
.sam_freqs
);
477 DumpASFmtType(const usb_audio_format_descriptor
* descriptor
)
479 uint8 format
= descriptor
->format_type
;
481 case USB_AUDIO_FORMAT_TYPE_I
:
482 DumpASFormatTypeI(descriptor
);
484 case USB_AUDIO_FORMAT_TYPE_II
:
485 DumpASFormatTypeII(descriptor
);
487 case USB_AUDIO_FORMAT_TYPE_III
:
488 DumpASFormatTypeIII(descriptor
);
491 DumpDescriptorData((usb_generic_descriptor
*)descriptor
);
498 DumpMPEGCapabilities(uint16 capabilities
)
500 const char* MPEGCapabilities
[] = {
506 "MPEG-1 dual-channel",
507 "MPEG-2 second stereo",
508 "MPEG-2 7.1 channel augumentation",
509 "Adaptive multi-channel predicion"
514 i
< sizeof(MPEGCapabilities
) / sizeof(MPEGCapabilities
[0]); i
++) {
515 if (capabilities
& mask
)
516 printf(" %s\n", MPEGCapabilities
[i
]);
520 mask
= 0x300; // bits 8 and 9
521 uint16 multilingualSupport
= (capabilities
& mask
) >> 8;
522 switch (multilingualSupport
) {
524 printf(" No Multilingual support\n");
527 printf(" Supported at Fs\n");
530 printf(" Supported at Fs and 1/2Fs\n");
539 DumpMPEGFeatures(uint8 features
)
541 uint8 mask
= 0x30; // bits 4 and 5
542 uint8 dynRangeControl
= (features
& mask
) >> 4;
543 switch (dynRangeControl
) {
545 printf(" Not supported\n");
548 printf(" Supported, not scalable\n");
551 printf(" Scalable, common boost, "
552 "cut scaling value\n");
555 printf(" Scalable, separate boost, "
556 "cut scaling value\n");
564 DumpASFmtSpecificMPEG(const usb_generic_descriptor
* descriptor
)
566 printf(" Subtype ........... %u (FORMAT_SPECIFIC)\n",
567 descriptor
->data
[0]);
568 printf(" Format Tag ........ %u\n",
569 *(uint16
*)&descriptor
->data
[1]);
570 printf(" MPEG Capabilities . %u\n",
571 *(uint16
*)&descriptor
->data
[3]);
572 DumpMPEGCapabilities(*(uint16
*)&descriptor
->data
[3]);
573 printf(" MPEG Features ..... %u\n",
574 descriptor
->data
[5]);
575 DumpMPEGFeatures(descriptor
->data
[5]);
580 DumpAC_3Features(uint8 features
)
582 const char* featuresStr
[] = {
590 for (uint8 i
= 0; i
< sizeof(featuresStr
) / sizeof(const char*); i
++) {
592 printf(" %s\n", featuresStr
[i
]);
596 mask
= 0x30; // bits 4 and 5
597 uint8 dynRangeControl
= (features
& mask
) >> 4;
598 switch (dynRangeControl
) {
600 printf(" Not supported\n");
603 printf(" Supported, not scalable\n");
606 printf(" Scalable, common boost, "
607 "cut scaling value\n");
610 printf(" Scalable, separate boost, "
611 "cut scaling value\n");
619 DumpASFmtSpecificAC_3(const usb_generic_descriptor
* descriptor
)
621 printf(" Subtype ........... %u (FORMAT_TYPE)\n",
622 descriptor
->data
[0]);
623 printf(" Format Tag ........ %u\n",
624 *(uint16
*)&descriptor
->data
[1]);
625 printf(" BSID .............. %" B_PRIx32
"\n",
626 *(uint32
*)&descriptor
->data
[2]);
627 printf(" AC3 Features ...... %u\n",
628 descriptor
->data
[6]);
629 DumpAC_3Features(descriptor
->data
[6]);
634 DumpASFmtSpecific(const usb_generic_descriptor
* descriptor
)
637 TYPE_II_UNDEFINED
= 0x1000,
642 uint16 formatTag
= *(uint16
*)&descriptor
->data
[1];
645 DumpASFmtSpecificMPEG(descriptor
);
648 DumpASFmtSpecificAC_3(descriptor
);
651 DumpDescriptorData(descriptor
);
658 DumpAudioStreamCSInterfaceDescriptor(const usb_generic_descriptor
* descriptor
)
660 uint8 subtype
= descriptor
->data
[0];
662 case USB_AUDIO_AS_GENERAL
:
663 DumpGeneralASInterfaceDescriptor(
664 (usb_audio_streaming_interface_descriptor
*)descriptor
);
666 case USB_AUDIO_AS_FORMAT_TYPE
:
668 (usb_audio_format_descriptor
*)descriptor
);
670 case USB_AUDIO_AS_FORMAT_SPECIFIC
:
671 DumpASFmtSpecific(descriptor
);
674 DumpDescriptorData(descriptor
);
681 DumpAudioStreamCSEndpointDescriptor(
682 const usb_audio_streaming_endpoint_descriptor
* descriptor
)
684 printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
685 descriptor
->descriptor_type
);
686 printf(" Subtype ........... 0x%02x (EP_GENERAL)\n",
687 descriptor
->descriptor_subtype
);
688 printf(" Attributes ........ 0x%02x ",
689 descriptor
->attributes
);
691 const char* attributes
[] = {
692 "Sampling Frequency",
699 for (uint8 i
= 0; i
< sizeof(attributes
) / sizeof(attributes
[0]); i
++) {
700 if ((descriptor
->attributes
& mask
) != 0)
701 printf("%s ", attributes
[i
]);
706 const char* aUnits
[] = {
709 "Decoded PCM samples",
713 const char* units
= descriptor
->lock_delay_units
>= 4
714 ? aUnits
[3] : aUnits
[descriptor
->lock_delay_units
];
716 printf(" Lock Delay Units .. %u (%s)\n",
717 descriptor
->lock_delay_units
, units
);
718 printf(" Lock Delay ........ %u\n",
719 descriptor
->lock_delay
);
724 DumpMidiInterfaceHeaderDescriptor(
725 const usb_midi_interface_header_descriptor
* descriptor
)
727 printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
728 descriptor
->descriptor_type
);
729 printf(" Subtype ........... 0x%02x (MS_HEADER)\n",
730 descriptor
->descriptor_subtype
);
731 printf(" MSC Version ....... 0x%04x\n",
732 descriptor
->ms_version
);
733 printf(" Length ............ 0x%04x\n",
734 descriptor
->total_length
);
739 DumpMidiInJackDescriptor(
740 const usb_midi_in_jack_descriptor
* descriptor
)
742 printf(" Type .............. 0x%02x (CS_INTERFACE)\n",
743 descriptor
->descriptor_type
);
744 printf(" Subtype ........... 0x%02x (MIDI_IN_JACK)\n",
745 descriptor
->descriptor_subtype
);
746 printf(" Jack ID ........... 0x%02x\n",
748 // TODO can we get the string?
749 printf(" String ............ 0x%02x\n",
750 descriptor
->string_descriptor
);
752 switch (descriptor
->type
) {
753 case USB_MIDI_EMBEDDED_JACK
:
754 printf(" Jack Type ......... Embedded\n");
756 case USB_MIDI_EXTERNAL_JACK
:
757 printf(" Jack Type ......... External\n");
760 printf(" Jack Type ......... 0x%02x (unknown)\n",
768 DumpMidiOutJackDescriptor(
769 const usb_midi_out_jack_descriptor
* descriptor
)
771 printf(" Type .............. 0x%02x (CS_INTERFACE)\n",
772 descriptor
->descriptor_type
);
773 printf(" Subtype ........... 0x%02x (MIDI_OUT_JACK)\n",
774 descriptor
->descriptor_subtype
);
775 printf(" Jack ID ........... 0x%02x\n",
778 switch (descriptor
->type
) {
779 case USB_MIDI_EMBEDDED_JACK
:
780 printf(" Jack Type ......... Embedded\n");
782 case USB_MIDI_EXTERNAL_JACK
:
783 printf(" Jack Type ......... External\n");
786 printf(" Jack Type ......... 0x%02x (unknown)\n",
791 for (int i
= 0; i
< descriptor
->inputs_count
; i
++) {
792 printf(" Pin %02d ............ (%d,%d)\n", i
,
793 descriptor
->input_source
[i
].source_id
,
794 descriptor
->input_source
[i
].source_pin
);
800 DumpMidiStreamCSInterfaceDescriptor(const usb_generic_descriptor
* descriptor
)
802 uint8 subtype
= descriptor
->data
[0];
804 case USB_MS_HEADER_DESCRIPTOR
:
805 DumpMidiInterfaceHeaderDescriptor(
806 (usb_midi_interface_header_descriptor
*)descriptor
);
808 case USB_MS_MIDI_IN_JACK_DESCRIPTOR
:
809 DumpMidiInJackDescriptor(
810 (usb_midi_in_jack_descriptor
*)descriptor
);
812 case USB_MS_MIDI_OUT_JACK_DESCRIPTOR
:
813 DumpMidiOutJackDescriptor(
814 (usb_midi_out_jack_descriptor
*)descriptor
);
816 case USB_MS_ELEMENT_DESCRIPTOR
:
818 DumpDescriptorData(descriptor
);
821 DumpDescriptorData(descriptor
);
828 DumpMidiStreamCSEndpointDescriptor(
829 const usb_midi_endpoint_descriptor
* descriptor
)
831 printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
832 descriptor
->descriptor_type
);
833 printf(" Subtype ........... 0x%02x (MS_GENERAL)\n",
834 descriptor
->descriptor_subtype
);
835 printf(" Jacks ............. ");
837 for (int i
= 0; i
< descriptor
->jacks_count
; i
++)
838 printf("%d, ", descriptor
->jacks_id
[i
]);
845 DumpAudioStreamInterfaceDescriptor(const usb_interface_descriptor
* descriptor
)
847 printf(" Type .............. %u (INTERFACE)\n",
848 descriptor
->descriptor_type
);
849 printf(" Interface ........... %u\n",
850 descriptor
->interface_number
);
851 printf(" Alternate setting ... %u\n",
852 descriptor
->alternate_setting
);
853 printf(" Endpoints ........... %u\n",
854 descriptor
->num_endpoints
);
855 printf(" Interface class ..... %u (AUDIO)\n",
856 descriptor
->interface_class
);
857 printf(" Interface subclass .. %u (AUDIO_STREAMING)\n",
858 descriptor
->interface_subclass
);
859 printf(" Interface ........... %u\n",
860 descriptor
->interface
);
865 DumpAudioDescriptor(const usb_generic_descriptor
* descriptor
, int subclass
)
867 const uint8 USB_AUDIO_INTERFACE
= 0x04;
870 case USB_AUDIO_INTERFACE_AUDIOCONTROL_SUBCLASS
:
871 switch (descriptor
->descriptor_type
) {
872 case USB_AUDIO_CS_INTERFACE
:
873 DumpAudioControlCSInterfaceDescriptor(descriptor
);
876 DumpDescriptorData(descriptor
);
880 case USB_AUDIO_INTERFACE_AUDIOSTREAMING_SUBCLASS
:
881 switch (descriptor
->descriptor_type
) {
882 case USB_AUDIO_INTERFACE
:
883 DumpAudioStreamInterfaceDescriptor(
884 (const usb_interface_descriptor
*)descriptor
);
886 case USB_AUDIO_CS_INTERFACE
:
887 DumpAudioStreamCSInterfaceDescriptor(descriptor
);
889 case USB_AUDIO_CS_ENDPOINT
:
890 DumpAudioStreamCSEndpointDescriptor(
891 (const usb_audio_streaming_endpoint_descriptor
*)descriptor
);
894 DumpDescriptorData(descriptor
);
898 case USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS
:
899 switch (descriptor
->descriptor_type
) {
900 case USB_AUDIO_CS_INTERFACE
:
901 DumpMidiStreamCSInterfaceDescriptor(descriptor
);
903 case USB_AUDIO_CS_ENDPOINT
:
904 DumpMidiStreamCSEndpointDescriptor(
905 (const usb_midi_endpoint_descriptor
*)descriptor
);
908 DumpDescriptorData(descriptor
);
913 DumpDescriptorData(descriptor
);