summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSaulo VerĂ­ssimo <[email protected]>2026-04-22 18:04:56 -0300
committerSaulo VerĂ­ssimo <[email protected]>2026-05-12 11:07:45 -0300
commit97852816e873bf7f91f3a81f093ad08f96179656 (patch)
tree2674623ed18af99f131b31f03f713705e5fd5bd1 /test
parent0c68ca8c1de45e24ae022ab58934c6930bad7b4b (diff)
midi2: align descriptors with USB-MIDI 2.0 spec
Brings the MIDI 2.0 device driver into full conformance with USB Device Class Definition for MIDI Devices v2.0 (USB-IF, May 2020). - Alt 1 MS Interface Header wTotalLength now reports 0x0007 per Table 5-2 ("set to match bLength"), replacing the prior 0x0011 carried over from USB-MIDI 1.0 conventions. - GET_DESCRIPTOR class request now validates bmRequestType direction, type and recipient plus wIndex and wValue high byte per Section 6. - iBlockItem in the default Group Terminal Block is driven by CFG_TUD_MIDI2_BLOCK_STRIDX so applications can attach a UI string descriptor to the block per Table 5-6. - UMP word byte order assumption (little-endian host per Section 3.2.2) is documented inline so future big-endian ports know where to wrap access with tu_htole32 / tu_le32toh. Validated on RP2040 and ESP32-P4 under Linux kernel 6.17: lsusb -v reports wTotalLength = 0x0007 on Alt 1 MS Header (raw bytes 07 24 01 00 02 07 00). amidi -l enumerates Group Terminals exposed via the class-specific GET_DESCRIPTOR response.
Diffstat (limited to 'test')
-rw-r--r--test/unit-test/test/device/midi2/test_midi2_device.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/unit-test/test/device/midi2/test_midi2_device.c b/test/unit-test/test/device/midi2/test_midi2_device.c
index 9d716d93b..1314c2585 100644
--- a/test/unit-test/test/device/midi2/test_midi2_device.c
+++ b/test/unit-test/test/device/midi2/test_midi2_device.c
@@ -147,6 +147,9 @@ void test_midi2_descriptor_bytes(void) {
TEST_ASSERT_EQUAL(MIDI_CS_INTERFACE_HEADER, desc[ms2_offset + 2]);
TEST_ASSERT_EQUAL(0x00, desc[ms2_offset + 3]);
TEST_ASSERT_EQUAL(0x02, desc[ms2_offset + 4]);
+ // USB-MIDI 2.0 Table 5-2: wTotalLength shall match bLength (= 0x0007)
+ TEST_ASSERT_EQUAL(0x07, desc[ms2_offset + 5]);
+ TEST_ASSERT_EQUAL(0x00, desc[ms2_offset + 6]);
}
void test_midi2_descriptor_alt1_cs_endpoint_subtype(void) {