summaryrefslogtreecommitdiff
path: root/src/host
AgeCommit message (Collapse)Author
10 hoursusbh: fix mount and enumeration retry stateHiFiPHile
10 hourshost: retry enumeration of the roothub port after a failed attachJan Procházka
enum_full_complete() already closes the failed device (from #3815). Nothing retries the root port itself: the host then sits idle until reboot. Re-post the attach up to USBH_ENUM_ROOT_RETRY_MAX times while the port still reports a connection. The budget is per port and given back when the attachment ends, including when an attach event tears down an in-flight enumeration. tuh_umount_cb() is only called for a device that reached tuh_mounted(). Co-authored-by: Cursor <[email protected]>
10 hourshost: close dev0 when the whole roothub port goes awayJan Procházka
A remove for hub_addr = 0, hub_port = 0 covers everything below the root port, but process_remove_event() only closed dev0 when the event named the exact bus address it was enumerating on. Mid-enumeration behind a downstream hub then left enumerating_daddr at 0 and deferred every later attach. Co-authored-by: Cursor <[email protected]>
2 daysMerge remote-tracking branch 'origin/master' into ↵HiFiPHile
agent/fix-dwc2-host-fifo-allocation
2 daysUSBH: fail enumeration cleanly after disconnectHiFiPHile
A disconnect can close endpoint zero after an enumeration control stage completes but before USBH submits the next stage or request. HCD submission then legitimately returns false; treating that result as an invariant violation asserts during rapid replug and can leave enumeration unfinished. Complete an in-progress control request as failed when its DATA or status stage cannot be submitted. Propagate submission failures from every asynchronous enumeration continuation and finish enumeration through the normal failure cleanup path. This keeps controller teardown races out of assertions without fabricating a successful transfer. Validated by interrupting enumeration during rapid STM32U5A5 replug tests with DWC2 DMA and slave modes.
3 daysMerge pull request #3828 from dxbjavid/ep2drv-endpoint-boundZixun LI
bound endpoint number in tu_bind_driver_to_ep_itf
3 dayspropagate the endpoint-bound failure on the host pathHiFiPHile
tu_bind_driver_to_ep_itf() now returns false when ep_num >= CFG_TUH_ENDPOINT_MAX, but the host caller ignores that result and continues enumeration. Configurations such as host/bare_api set the limit to 8, while valid USB devices may use endpoints 8–15. A recognized class can therefore continue and later index ep_status[epnum] or ep2drv[epnum] out of bounds. Wrap this call in TU_ASSERT(...), as the device path already does, so parsing fails immediately. Signed-off-by: HiFiPHile <[email protected]>
2026-08-21vendor: remove the obsolete host vendor driverhathach
vendor_host.c/.h implemented a CFG_TUH_VENDOR class driver that no example, board or test ever enabled: usbh's driver table entry was compiled out everywhere, and the six tusb_config.h files that mentioned the macro all set it to 0. Maintainer call - dead code, not a shrinking of supported classes. Removes the sources, the usbh driver-table entry, the CFG_TUH_VENDOR default in tusb_option.h, the tusb.h include, both build-system source lists, the rp2040 family.cmake entry and the IAR project template rows.
2026-08-17bound endpoint number in tu_bind_driver_to_ep_itfJavid Khan
2026-07-05Fix usbh empty builtin driver warningHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
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-06-22Merge remote-tracking branch 'tinyusb/master' into pr-osal-spin-deinitHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-22usbh: remove Pico specific commentHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-06-21fix(host): release spinlock in tuh_deinit to fix multi-rebuild panicrenjie
tuh_rhport_init() calls osal_spin_init(&_usbh_spin), which under OPT_OS_PICO claims a hardware spinlock via critical_section_init(). There was no osal_spin_deinit(), so tuh_deinit() never released it: every host init/deinit cycle leaked one spinlock. RP2350 has a small spinlock pool, so a few usb_host rebuilds exhaust it and hw_claim_unused_from_range() panics (the long-standing "crashes on the 4th rebuild" bug). Add osal_spin_deinit() to all OSAL backends (critical_section_deinit for pico; no-op for none/freertos) and call it in tuh_deinit(). Verified 20/20 deinit+rebuild cycles on RP2350-Zero and Waveshare RP2350-USB-A (previously panicked on the 4th). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-01CFG_TUH_CONTROL_PENDING_QUEUE_SZ defefault to 4 if hub is eanbled, 2 if nothathach
2026-05-29Implement asynchronous control transfer queuing for USB host stackhathach
- Added a pending FIFO queue for asynchronous control transfers when the active slot is busy. - Introduced `control_xfer_dispatch_pending` to handle queued transfers on slot availability. - Improved synchronization for blocking and non-blocking transfer modes, preventing deadlocks in RTOS. - Refactored and renamed related functions for clarity and consistency. - Enhanced error handling and callback invocation for failed or stale transfers.
2026-05-12feat: add MIDI 2.0 Host class driver (USB-MIDI 2.0)Saulo Veríssimo
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
2026-05-04refactor: replace `tu_edpt_state_t` struct with `uint8_t` and update all ↵hathach
endpoint state handling methods and accesses
2026-03-22False negative in tuh_task_event_ready()Cédric Berger
2026-03-22False positive in tuh_task_event_ready()Cédric Berger
2026-03-22We must wait at least the requested amountCédric Berger
2026-03-12refactor(config): separate endpoint buffer sizes into RX and TX definitions ↵hathach
for clarity and flexibility
2026-03-09fix(usbh): correct memcpy usage to ensure proper alignment with `offsetof` ↵hathach
in device descriptor handling
2026-03-09refactor: add desc_device_noheader_t to simplify get device descriptor localhathach
2026-03-09usbh device descriptor validation, also check ep size > 0hathach
2026-03-07open hub mtt interface in 1 callhathach
2026-03-06fix ciHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-03-06usbh: support MTT hubHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-03-04Merge branch 'master' into dwc2_deinithathach
2026-03-02more call_after timeout adjustment with rtoshathach
2026-03-02improve timeout adjustment, exit tuh_task() by timeout_ms = 0hathach
2026-03-02fix call_after timeout adjustment with rtoshathach
2026-03-02- rename to usbh_defer_func_ms_async()hathach
- call after (enum non-blocking delay) also support rtos now
2026-02-28replace board_millis() with tusb_time_millis_api()hathach
2026-02-27add back deferred attachment queue, retry get hub port status if reset ↵hathach
change not set after 20ms
2026-02-27Merge remote-tracking branch 'tinyusb/master' into dwc2_deinitHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-02-26fix fallthroughhathach
2026-02-26revert usbh dedicated queue for attached eventhathach
2026-02-26refactor, rename to schedule function with usbh_call_after_ms() to use with ↵hathach
enumeration delay
2026-02-22Merge branch 'hathach:master' into non-blocking-host-v2Cédric Berger
2026-02-22Apply suggestions from code reviewZixun LI
Co-authored-by: Copilot <[email protected]>
2026-02-20refactor config optionHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-02-19Introduce TUH_CFGID_PHY_SPEED configure optionCédric Berger
2026-02-14add(usbh.c): LOG1 debug message when no address available for hubRoman Leonov
2026-02-11Put deferred attachments in a separate queueCédric Berger
2026-02-11Call continuation functions asynchronouslyCédric Berger
2026-02-11Split functions calling tusb_time_delay_ms_api()Cédric Berger
2026-02-01Actually exit the loop in addition to logging. ENOTENOUGHCOFFEECédric Berger
2026-02-01Limit events processed by tud_task_ext() / tuh_task_ext()Cédric Berger
2026-01-06catch deinit errorHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>