[prev in list] [next in list] [prev in thread] [next in thread]
List: haiku-commits
Subject: [haiku-commits] haiku: hrev48751 - src/bin
From: pulkomandy () pulkomandy ! tk
Date: 2015-01-30 20:13:49
Message-ID: 20150130201350.0D1F55C2406 () vmrepo ! haiku-os ! org
[Download RAW message or body]
hrev48751 adds 1 changeset to branch 'master'
old head: 3df82f281333e7a24c739adc5f1dc4cc7eb32ab6
new head: 39a1cc8ec3a8e1567431391e489ddc5acb009b41
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=39a1cc8ec3a8+%5E3df82f281333
----------------------------------------------------------------------------
39a1cc8ec3a8: listusb: dump MIDI endpoint descriptors.
* These would be completely skipped before because of a bug in the USB
audio dumping code.
* Now they are decoded in human readable format
* Also fix a typo (Ttype instead of Type) in audio endpoints formatting.
[ Adrien Destugues <pulkomandy@gmail.com> ]
----------------------------------------------------------------------------
Revision: hrev48751
Commit: 39a1cc8ec3a8e1567431391e489ddc5acb009b41
URL: http://cgit.haiku-os.org/haiku/commit/?id=39a1cc8ec3a8
Author: Adrien Destugues <pulkomandy@gmail.com>
Date: Fri Jan 30 20:13:35 2015 UTC
----------------------------------------------------------------------------
1 file changed, 140 insertions(+), 1 deletion(-)
src/bin/listusb.cpp | 141 +++++++++++++++++++++++++++++++++++++++++++++++-
----------------------------------------------------------------------------
diff --git a/src/bin/listusb.cpp b/src/bin/listusb.cpp
index 57ec225..f0d20b6 100644
--- a/src/bin/listusb.cpp
+++ b/src/bin/listusb.cpp
@@ -14,6 +14,7 @@
#include <USBKit.h>
#include <stdio.h>
#include <usb/USB_audio.h>
+#include <usb/USB_midi.h>
#include "usbspec_private.h"
#include "usb-utils.h"
@@ -729,7 +730,7 @@ void
DumpAudioStreamCSEndpointDescriptor(
const usb_audio_streaming_endpoint_descriptor* descriptor)
{
- printf(" Ttype ............. 0x%02x (CS_ENDPOINT)\n",
+ printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
descriptor->descriptor_type);
printf(" Subtype ........... 0x%02x (EP_GENERAL)\n",
descriptor->descriptor_subtype);
@@ -769,6 +770,127 @@ DumpAudioStreamCSEndpointDescriptor(
void
+DumpMidiInterfaceHeaderDescriptor(
+ const usb_midi_interface_header_descriptor* descriptor)
+{
+ printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
+ descriptor->descriptor_type);
+ printf(" Subtype ........... 0x%02x (MS_HEADER)\n",
+ descriptor->descriptor_subtype);
+ printf(" MSC Version ....... 0x%04x\n",
+ descriptor->ms_version);
+ printf(" Length ............ 0x%04x\n",
+ descriptor->total_length);
+}
+
+
+void
+DumpMidiInJackDescriptor(
+ const usb_midi_in_jack_descriptor* descriptor)
+{
+ printf(" Type .............. 0x%02x (CS_INTERFACE)\n",
+ descriptor->descriptor_type);
+ printf(" Subtype ........... 0x%02x (MIDI_IN_JACK)\n",
+ descriptor->descriptor_subtype);
+ printf(" Jack ID ........... 0x%02x\n",
+ descriptor->id);
+ // TODO can we get the string?
+ printf(" String ............ 0x%02x\n",
+ descriptor->string_descriptor);
+
+ switch (descriptor->type) {
+ case USB_MIDI_EMBEDDED_JACK:
+ printf(" Jack Type ......... Embedded\n");
+ break;
+ case USB_MIDI_EXTERNAL_JACK:
+ printf(" Jack Type ......... External\n");
+ break;
+ default:
+ printf(" Jack Type ......... 0x%02x (unknown)\n",
+ descriptor->type);
+ break;
+ }
+}
+
+
+void
+DumpMidiOutJackDescriptor(
+ const usb_midi_out_jack_descriptor* descriptor)
+{
+ printf(" Type .............. 0x%02x (CS_INTERFACE)\n",
+ descriptor->descriptor_type);
+ printf(" Subtype ........... 0x%02x (MIDI_OUT_JACK)\n",
+ descriptor->descriptor_subtype);
+ printf(" Jack ID ........... 0x%02x\n",
+ descriptor->id);
+
+ switch (descriptor->type) {
+ case USB_MIDI_EMBEDDED_JACK:
+ printf(" Jack Type ......... Embedded\n");
+ break;
+ case USB_MIDI_EXTERNAL_JACK:
+ printf(" Jack Type ......... External\n");
+ break;
+ default:
+ printf(" Jack Type ......... 0x%02x (unknown)\n",
+ descriptor->type);
+ break;
+ }
+
+ for (int i = 0; i < descriptor->inputs_count; i++) {
+ printf(" Pin %02d ............ (%d,%d)\n", i,
+ descriptor->input_source[i].source_id,
+ descriptor->input_source[i].source_pin);
+ }
+}
+
+
+void
+DumpMidiStreamCSInterfaceDescriptor(const usb_generic_descriptor* descriptor)
+{
+ uint8 subtype = descriptor->data[0];
+ switch (subtype) {
+ case USB_MS_HEADER_DESCRIPTOR:
+ DumpMidiInterfaceHeaderDescriptor(
+ (usb_midi_interface_header_descriptor*)descriptor);
+ break;
+ case USB_MS_MIDI_IN_JACK_DESCRIPTOR:
+ DumpMidiInJackDescriptor(
+ (usb_midi_in_jack_descriptor*)descriptor);
+ break;
+ case USB_MS_MIDI_OUT_JACK_DESCRIPTOR:
+ DumpMidiOutJackDescriptor(
+ (usb_midi_out_jack_descriptor*)descriptor);
+ break;
+ case USB_MS_ELEMENT_DESCRIPTOR:
+ // TODO
+ DumpDescriptorData(descriptor);
+ break;
+ default:
+ DumpDescriptorData(descriptor);
+ break;
+ }
+}
+
+
+void
+DumpMidiStreamCSEndpointDescriptor(
+ const usb_midi_endpoint_descriptor* descriptor)
+{
+ printf(" Type .............. 0x%02x (CS_ENDPOINT)\n",
+ descriptor->descriptor_type);
+ printf(" Subtype ........... 0x%02x (MS_GENERAL)\n",
+ descriptor->descriptor_subtype);
+ printf(" Jacks ............. ");
+
+ for (int i = 0; i < descriptor->jacks_count; i++)
+ printf("%d, ", descriptor->jacks_id[i]);
+
+ printf("\n");
+}
+
+
+void
DumpAudioStreamInterfaceDescriptor(const usb_interface_descriptor* descriptor)
{
printf(" Type .............. %u (INTERFACE)\n",
@@ -822,6 +944,23 @@ DumpAudioDescriptor(const usb_generic_descriptor* descriptor, int subclass)
break;
}
break;
+ case USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS:
+ switch (descriptor->descriptor_type) {
+ case USB_AUDIO_CS_INTERFACE:
+ DumpMidiStreamCSInterfaceDescriptor(descriptor);
+ break;
+ case USB_AUDIO_CS_ENDPOINT:
+ DumpMidiStreamCSEndpointDescriptor(
+ (const usb_midi_endpoint_descriptor*)descriptor);
+ break;
+ default:
+ DumpDescriptorData(descriptor);
+ break;
+ }
+ break;
+ default:
+ DumpDescriptorData(descriptor);
+ break;
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic