| Age | Commit message (Collapse) | Author |
|
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.
|
|
Keep the MIDI 2.0 drivers fully self-contained, with no changes to
shared or generic stack code.
Allocate the per-endpoint buffer in both midi2_host and midi2_device,
following the convention used by cdc, midi, vendor, and printer.
The class buffer struct is declared unconditionally and passed to
tu_edpt_stream_init on every init, so the streaming helpers operate
on the same shape across all classes.
|
|
- Use UINT32_C(1) instead of 1u for bit shifts >= 16 in
midi2_device.c to avoid shift-count-overflow on 16-bit
platforms (MSP430)
- Add Makefiles for midi2_device and midi2_host examples with
family guard (skip if FAMILY != rp2040). These examples
require Pico SDK and board-specific hardware
- Restrict midi2_device CMakeLists.txt to rp2040 family
(matching midi2_host)
|
|
Host driver (midi2_host.c):
- midih2_open() now returns actual parsed length instead of max_len,
preventing composite device interface conflicts
- Parsers (alt0/alt1) refactored to return const uint8_t* end pointer
following midi_host.c switch/case pattern
- Alt 1 CS Endpoint now parses MIDI 2.0 layout (bNumGrpTrmBlk at
offset 3 with MIDI_CS_ENDPOINT_GENERAL_2_0 subtype check) instead
of reusing MIDI 1.0 struct (bNumEmbMIDIJack)
- midih2_set_config() now issues SET_INTERFACE control request via
tuh_interface_set() before completing configuration. Falls back to
alt 0 if SET_INTERFACE fails
- Extracted midih2_set_config_complete() and midih2_set_interface_cb()
for async SET_INTERFACE handling
Device driver (midi2_device.c):
- midi2d_open() skip loop now checks bInterfaceNumber, stopping at
interfaces that belong to other functions in composite devices
- SET_INTERFACE handler now rejects alt > 1 (returns false/stall)
- Named constants for GTB descriptor types and MIDI protocol values
Descriptor macros (usbd.h):
- TUD_MIDI2_DESC_ALT1_HEAD: iInterface set to 0 (consistent with
Alt 0), wTotalLength now uses TUD_MIDI2_DESC_ALT1_CS_LEN to cover
all Alt 1 class-specific descriptors
- TUD_MIDI2_DESC_ALT1_EP: now accepts GTB ID list via variadic args,
emitting complete CS endpoint descriptor
Host example:
- CMakeLists.txt restricted to rp2040 family (display.c requires
Pico SDK headers)
- display.c: null terminator after strncpy in log scroll
Documentation:
- class_drivers.rst updated to reflect SET_INTERFACE behavior and
auto-select with fallback
Addresses: Codex P1 (#1, #2, #3), Copilot (#4-#9)
|
|
Add native USB-MIDI 2.0 Host class driver to TinyUSB. Implements
reactive architecture: enumerate, detect MIDI 2.0 capability, inform
application via callbacks.
Driver features:
- Parse both Alt Setting 0 (MIDI 1.0) and Alt Setting 1 (UMP)
- Detect bcdMSC version from descriptor
- Auto-select highest protocol (Alt 1 preferred if available)
- UMP read/write via endpoint streams
- Proper Audio Control interface skip (loop-based, following
midi_host.c pattern)
- Endpoint open with tuh_edpt_open/tu_edpt_stream_open/clear
- usbh_driver_set_config_complete for USBH state machine
- Handle Audio Control itf_num in set_config gracefully
- 5 weak callback stubs (descriptor, mount, unmount, rx, tx)
Build system:
- Register midih2_* in usbh.c driver table
- Add midi2_host.h include to tusb.h
- Add CFG_TUH_MIDI2_LOG_LEVEL to tusb_option.h
All changes guarded by #if CFG_TUH_MIDI2 (default 0). Zero impact on
existing drivers and examples.
Tested: Waveshare RP2350-USB-A (Host) receiving UMP from Raspberry Pi
Pico (Device) via PIO-USB, board-to-board
|
|
Add native USB-MIDI 2.0 Device class driver to TinyUSB. Implements the
USB-MIDI 2.0 specification with both Alt Setting 0 (MIDI 1.0 fallback)
and Alt Setting 1 (UMP native) descriptor support.
Driver features:
- UMP (Universal MIDI Packet) read/write with atomic message framing
- Protocol negotiation: Endpoint Discovery, Config Request/Notify,
Function Block Discovery (embedded in driver)
- Group Terminal Block descriptor via GET_DESCRIPTOR
- Alt Setting switch handler with endpoint re-arm
- Static allocation, no dynamic memory, ISR-safe
Build system:
- Register midi2d_* in usbd.c driver table
- Add TUD_MIDI2_DESCRIPTOR macros to usbd.h
- Add config defaults (CFG_TUD_MIDI2_*) to tusb_option.h
- Add midi2_ump_word_count() to midi.h (shared by Device and Host)
- Add midi2_device.c/h to family.cmake and CMakeLists.txt
- Add midi2_device.h include to tusb.h
All changes guarded by #if CFG_TUD_MIDI2 (default 0). Zero impact on
existing drivers and examples.
Tested: Raspberry Pi Pico (RP2040), Linux ALSA, Windows MIDI Services
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
midi-host-rx-bufsize-default-and-docs
|
|
Even if CFG_TUH_MIDI_RX_BUFSIZE=100*TUH_EPSIZE_BULK_MAX, calling tuh_midi_stream_read without a loop can return only one 4-byte packet and preventing subsequent transfer.
Signed-off-by: Zixun LI <[email protected]>
|
|
Refactor USB control transfer handling into `usbd.c`
|
|
|
|
endpoint state handling methods and accesses
|
|
|
|
|
|
|
|
Signed-off-by: HiFiPHile <[email protected]>
|
|
According to NCM standard 7.2.7, the device should tell the host its maximum size of NTB. Implement SetNtbInputSize according to it.
Without this commit, some OS may failed to enumerate the NCM device (e.g., IOS 26).
Signed-off-by: Elwin Huang <[email protected]>
|
|
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Zixun LI <[email protected]>
|
|
|
|
|
|
extraction
- Add TU_BITFIELD_ORDER guards for audio10_desc_as_iso_data_ep_t.bmAttributes in audio.h
- Add TU_BITFIELD_ORDER guards for audio20_control_request_t.bmRequestType_bit in audio.h
- Fix cdc_uac2/src/uac2_app.c: replace alias cast with TU_U16_LOW/HIGH field extraction
- Fix uac2_headset/src/main.c: replace alias cast with TU_U16_LOW/HIGH field extraction
- Fix uac2_speaker_fb/src/main.c: replace alias cast with TU_U16_LOW/HIGH field extraction
Addresses review comment: https://github.com/hathach/tinyusb/pull/3597#issuecomment-4320042007
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/8b695271-74b3-4a26-b3d8-c48ecdf2e481
Co-authored-by: HiFiPhile <[email protected]>
|
|
# Conflicts:
# src/common/tusb_types.h
# src/portable/mentor/musb/dcd_musb.c
|
|
|
|
- Resolve .gitignore conflict: incorporate upstream's .worktrees entry and
expand dependency path patterns to cover all tools/get_deps.py fetched dirs
(lib/, tools/linkermap, tools/uf2, hw/mcu/*) instead of listing only a few
- Auto-merged upstream changes: build system cleanups, BSP updates,
portability fixes, new boards (nrf54lm20dk, stm32h743_weact),
fatfs relocation, and many other upstream improvements
- Net driver changes (ecm_rndis_device.c, ncm_device.c, net_device.h,
usbd.h, usb_descriptors.c) retain our PR's descriptor-based ep_size
approach as our branch takes precedence
Co-authored-by: HiFiPhile <[email protected]>
|
|
|
|
Follow-up to #3239. tuh_midi_stream_read terminates on cable-number
transitions, leaving residue in the FIFO. With the default RX FIFO
sized equal to one bulk packet, the next bulk IN transfer fails to
queue and the driver silently stops receiving. Raising the default
to 2x bulk gives single-call apps a full packet of headroom and
documents the drain-loop expectation.
Reproduced with Akai LPD8 mk1 (VID 09E8 PID 0075) on STM32H753 DWC2
host; fixed with this patch. See #3613 for full repro + captures.
|
|
|
|
|
|
mtp: fixes in add_string
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
|
|
64/512
Co-authored-by: HiFiPhile <[email protected]>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/4c20b579-db28-4643-b062-81881adcf6c1
|
|
Co-authored-by: HiFiPhile <[email protected]>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
|
|
Co-authored-by: HiFiPhile <[email protected]>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
|
|
Fix bugs in FSDEV HCD/DCD and MIDI host stream write
|
|
- hcd_edpt_clear_stall: use ep_addr instead of hardcoded 0 (control endpoint)
- hcd: add TUP_USBIP_FSDEV_DRD define for MCUs with host support (C0, G0, H5,
U3, U5) and use it in hcd compile guard instead of enumerating MCUs
- dcd_edpt_close_all: use FSDEV_EP_COUNT instead of CFG_TUD_ENDPPOINT_MAX for
PMA btable offset to match handle_bus_reset
- midi host tuh_midi_stream_write: add missing cable_num to system messages,
SysEx, and real-time MIDI packets. Add 0xF mask for SysEx CIN checks.
Aligns with midi_device.c tud_midi_n_stream_write implementation.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
|
CONFIG_GET_REPORT_DESC response
|
|
default is 1
|
|
|
|
|
|
|
|
Signed-off-by: Zixun LI <[email protected]>
|
|
compatibility with no-op macros
|
|
|
|
compile-time macros for simplicity and reduced complexity
|
|
|
|
|
|
for clarity and flexibility
|
|
|