summaryrefslogtreecommitdiff
path: root/src/device/usbd.h
AgeCommit message (Collapse)Author
2026-07-02license: use SPDX identifiers for src/ headers (#3749)Ha Thach
* license: use SPDX identifiers for src/ headers Replace the full ~20-line MIT license boilerplate on every src/ file with a two-line SPDX tag (SPDX-FileCopyrightText + SPDX-License-Identifier), following the REUSE convention used by CircuitPython and the Linux kernel. Removes ~3500 lines of duplicated boilerplate.
2026-05-12midi2: align descriptors with USB-MIDI 2.0 specSaulo Veríssimo
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.
2026-05-12fix: address PR review feedback for MIDI 2.0 driversSaulo Veríssimo
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)
2026-05-12feat: add MIDI 2.0 Device class driver (USB-MIDI 2.0)Saulo Veríssimo
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
2026-05-08Merge remote-tracking branch 'tinyusb/master' into ncm_packet_filterHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-01ncm: implement GetNtbInputSize requestZixun LI
Signed-off-by: HiFiPHile <[email protected]>
2026-04-30refactor capabilityZixun LI
Signed-off-by: Zixun LI <[email protected]>
2026-04-27NCM caps enumnminaylov
2026-04-24NCM packet filter supportnminaylov
2026-03-22net: upgrade net_lwip_webserver to separate FS/HS descriptors and add ↵copilot-swe-agent[bot]
bInterval to TUD_CDC_NCM_DESCRIPTOR Co-authored-by: HiFiPhile <[email protected]> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/e212b526-e279-4a83-88bf-a742df293165
2026-03-06update printer class: enhance descriptors, buffer sizes, and callbackshathach
2026-03-06Merge branch 'refs/heads/master' into fork/remiberthoz/device-class-printerhathach
2026-02-13use CFG_TUD_CONFIGURE_DWC2_DEFAULT to make it easier to add more valuehathach
2026-02-13add CFG_TUD_VBUS_SENSE, that could allow to skip tud_configure() for fixed ↵hathach
vbus sensing simplify dwc2_stm32_gccfg_cfg() using guid value
2026-02-13Merge branch 'refs/heads/master' into dwc2_vbushathach
2026-02-03Fix DFU descriptor version from 1.0.1 (0x0101) to 1.1.0 (0x0110)copilot-swe-agent[bot]
Co-authored-by: hathach <[email protected]>
2026-01-31dwc2: add vbus sense configHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-01-07Adjust printer device class to 0.20.0 and fix compilation warningsRémi Berthoz
2026-01-04Implement Printer Device ClassRémi Berthoz
2025-12-15Merge pull request #3364 from hathach/hcd_fsdevHa Thach
hcd: add stm32_fsdev driver
2025-11-30Update noteHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-11-21Apply suggestions from code reviewZixun LI
Co-authored-by: Copilot <[email protected]>
2025-11-21dcd/dwc2: add IN fifo configureHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-11-21dcd: add tud_configure()HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-11-04Fixed more alert found by PVS-Studiohathach
2025-10-30Merge branch 'master' into uac1HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-10-28fix Identifiers that start with '__' or '_[A-Z]' are reserved.hathach
fix compiling with nuc family
2025-10-24Merge remote-tracking branch 'upstream/master' into uac1HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-10-16fix some warnings detected by pvs-studiohathach
2025-10-03Merge remote-tracking branch 'tinyusb/master' into uac1Mengsk
2025-10-02mtp example work with highspeed devicehathach
2025-09-30Add UAC1 support to speaker exampleMengsk
Signed-off-by: Mengsk <[email protected]>
2025-09-30Update TUD_AUDIO_EP_SIZE macroMengsk
Signed-off-by: Mengsk <[email protected]>
2025-09-30Implement UAC1 IN flow controlHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-09-30Add basic UAC1 supportHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-09-30More descriptors workingHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-09-29Add UAC1.0 definesHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-09-15Merge branch 'master' into fork/ennebi/mtphathach
2025-09-12add all constant from MTP specs appendix, rename some e.g OPEC to OP, EVTC ↵hathach
to EVENT
2025-08-06Add MTP class deviceMaurizio Pesce
2025-07-03reduce bInterval for default CDC descriptor from 16ms to 1mshathach
2024-10-14change the tusb_rhport_init_t struct, exclude the rhport to make API more ↵hathach
consistent
2024-10-11change tusb_init(), tusb_rhport_init() to use init struct for expandabilityhathach
2024-07-28Merge branch 'master' of https://github.com/hathach/tinyusb into rx_fbHiFiPhile
2024-07-19also migrate tud_descriptor_device_qualifier_cb() / ↵hathach
tud_descriptor_other_speed_configuration_cb()
2024-07-19Additional fix related to issue #1018. Corrects the usage of TU_ATTR_WEAK ↵Frank Voorburg
for the Keil compiler for the callback functions: * tud_descriptor_bos_cb() * tud_vendor_control_xfer_cb() * tud_mount_cb() * tud_umount_cb() * tud_suspend_cb() * tud_resume_cb() Without the fix for the first two functions, the USB device won't enumerate properly, if the device makes use of a BOS description. For example when using a Microsoft OS 2.0 platform capability descriptor to set a specific Device Interface GUID for WinUSB. The fix for the other four functions were added, because it's probably just a matter of time before someone runs into the same problem with those callback functions.
2024-05-31Merge branch 'master' of https://github.com/hathach/tinyusb into rx_fbHiFiPhile
2024-05-27Merge branch 'master' into additional_dcd_sof_enableHiFiPhile
2024-05-27Fix tud_sof_cb_enable() return type.HiFiPhile
2024-05-24minor clean uphathach