diff options
| -rw-r--r-- | src/class/midi/midi_device.c | 8 | ||||
| -rw-r--r-- | src/device/usbd.h | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index 76776d71c..267167720 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -250,15 +250,13 @@ bool midid_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, (*p_length) = sizeof(tusb_desc_interface_t);
// Skip over the class specific descriptor.
- (*p_length) += p_desc[DESC_OFFSET_LEN];
+ (*p_length) += tu_desc_len(p_desc);
p_desc = tu_desc_next(p_desc);
return true;
}
- if ( AUDIO_SUBCLASS_MIDI_STREAMING != p_interface_desc->bInterfaceSubClass ||
- p_interface_desc->bInterfaceProtocol != AUDIO_PROTOCOL_V1 ) {
- return false;
- }
+ TU_VERIFY(AUDIO_SUBCLASS_MIDI_STREAMING == p_interface_desc->bInterfaceSubClass &&
+ AUDIO_PROTOCOL_V1 == p_interface_desc->bInterfaceProtocol );
// Find available interface
midid_interface_t * p_midi = NULL;
diff --git a/src/device/usbd.h b/src/device/usbd.h index d3a5dce66..bb9c62f2f 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -174,14 +174,12 @@ TU_ATTR_WEAK void tud_resume_cb(void); //------------- MIDI -------------//
// Length of template descriptor (96 bytes)
-#define TUD_MIDI_DESC_LEN (8 + 9 + 9 + 9 + 7 + 6 + 6 + 9 + 9 + 7 + 5 + 7 + 5)
+#define TUD_MIDI_DESC_LEN (9 + 9 + 9 + 7 + 6 + 6 + 9 + 9 + 7 + 5 + 7 + 5)
// MIDI simple descriptor
// - 1 Embedded Jack In connected to 1 External Jack Out
// - 1 Embedded Jack out connected to 1 External Jack In
#define TUD_MIDI_DESCRIPTOR(_itfnum, _stridx, _epin, _epout, _epsize) \
- /* Interface Associate */\
- 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_AUDIO, 0x00, AUDIO_PROTOCOL_V1, 0,\
/* Audio Control (AC) Interface */\
9, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUSB_CLASS_AUDIO, AUDIO_SUBCLASS_CONTROL, AUDIO_PROTOCOL_V1, _stridx,\
/* AC Header */\
|
