summaryrefslogtreecommitdiff
path: root/src/class
AgeCommit message (Collapse)Author
2026-07-08Merge branch 'usbtest': Linux kernel usbtest battery supporthathach
Brings the usbtest device example (gadget-zero source/sink peer for the kernel's usbtest.ko/testusb), the test/hil/usbtest.py battery runner and the extended vendor class driver (interrupt/isochronous endpoints, alt settings) into the CH569 SuperSpeed branch, enabling the battery to run against both CH56x dcds. Conflict resolution: test/hil/tinyusb.json keeps this branch's hydrausb3_v1 fixture entry and adds the usbtest branch's ch32v307v_r1_1v0 entry. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019MRGjBT2NBkCoWwyDT4LaE
2026-07-07Add SuperSpeed descriptors to all bulk/interrupt class drivers and exampleshathach
Class drivers: skip and account the SS endpoint companion descriptor in every descriptor walk (hid, midi, midi2, ecm_rndis, printer, mtp, usbtmc), via a shared usbd_skip_ss_ep_companion() helper in usbd_pvt.h (cdc/ncm already handled; vendor/dfu naturally tolerant). usbtmc buffer grows to 1024 at SS to satisfy its packet-multiple assert. bth/audio/video are left FS/HS-only (ISO-centric; ISO is unsupported on the CH569 dcd). usbd.h: new SS template macros TUD_HID_SS_DESCRIPTOR(+INOUT), TUD_MIDI_SS_DESCRIPTOR (+ DESC_EP_SS part), TUD_MIDI2_DESC_ALT1_EP_SS, TUD_PRINTER_SS_DESCRIPTOR, TUD_MTP_SS_DESCRIPTOR, TUD_USBTMC_BULK_SS_DESCRIPTORS/INT_SS_DESCRIPTOR, with _SS_DESC_LEN counterparts (bulk endpoints hardcode 1024, companion after every EP). Examples: 17 bulk/interrupt examples gain the full SS descriptor set (EP0 512/64 clamp, SS device descriptor bcdUSB 3.20 mps0=2^9, SS config with companions, BOS caps, speed-switched callbacks): cdc_dual_ports, cdc_msc_freertos, dfu, dfu_runtime, dynamic_configuration, hid_boot_interface, hid_composite(+freertos), hid_generic_inout, hid_multiple_interface, midi_test(+freertos), midi2_device, msc_dual_lun, mtp, printer_to_cdc, usbtmc, webusb_serial. msc_dual_lun is un-skipped for CH569 using read-only flash disks (16KB RAM can't hold two 8KB RAM disks, same as ch32v10x/v20x boards). Validation: full example sweep green for hydrausb3_v1 (SPEED=super, 19 device ELFs) and raspberry_pi_pico; wTotalLength == sizeof() verified for every SS configuration array in the built ELFs; ceedling 65/65; pre-commit clean; code-size delta +0.0% on rp2040 (SS code folds out on non-SS builds). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019MRGjBT2NBkCoWwyDT4LaE
2026-07-07Add SuperSpeed support to CDC-NCM and enable iperf on CH569hathach
- TUD_CDC_NCM_SS_DESCRIPTOR template (bulk 1024 + endpoint companions) and companion handling in netd_open (notification endpoint skip, bulk pair drv_len) - net_lwip_webserver: SS device/config/BOS descriptors for the NCM build, CH569 added to the LWIP_HIGH_THROUGHPUT tier (builds lwiperf). The 16 KB RAMS cannot hold lwIP: heap and pools go to the 32 KB RAMX via LWIP_DECLARE_MEMORY_ALIGNED (arch/cc.h), with a 6-pbuf pool / 6*MSS window and a 3 KB dcd bounce pool to fit (RAMX 92%) - CH569 dcd fixes found while bringing this up: TMR0 counts only 26 bits, so the previous 1 s fallback CNT_END (120e6 > 2^26) silently never expired - use 0.55 s per phase; make link busy-waits in usb30_hw_init best-effort so a stuck-BUSY teardown state cannot abort re-initialization half way Builds clean (full ch56x example sweep); NOT yet hardware-validated: the rig's WCH-LinkE stopped completing flash writes mid-session (reads and erases fine), leaving the board without firmware - iperf numbers pending physical probe/board recovery. Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-07usbtest: address Codex re-review (5 findings)hathach
- rp2040 dcd_edpt_clear_stall: the toggle-reset re-issue rewound remaining_len only for IN, but bufctrl_prepare16() pre-subtracts it for OUT too, so an OUT re-issue was short by the still-armed buffers. Rewind both directions (user_buf only for IN, which advances at DPRAM-copy time). Validated: pico usbtest 30/30. - usb_recover.sh: refuse pci-rebind/reset/bind on a BDF that is not a USB controller (class 0x0c03xx), so a stray/mistyped address can't disturb storage or NICs on the shared HIL host. Guard tested against real BDFs. - ip3511 dcd_edpt_open: make it tolerant of reopening a still-armed endpoint instead of asserting it disabled -- retire via EPSKIP (UM11126 41.7.6/41.8.3) then force disabled. This is the correct ISO_ALLOC reopen contract, since usbd_edpt_close() is a no-op there. NOTE: audio/video streaming EPs already use usbd_edpt_iso_activate() on ISO_ALLOC, so there is no in-tree trigger; this is defensive hardening for a class that reopens a non-iso EP via usbd_edpt_open (e.g. a UVC device with a notification EP + VC SET_INTERFACE). Verified on HW: lpc11u37 usbtest 30/30 and video_capture SET_INTERFACE cycling both fine. - vendor_device set_alt: abort the outgoing altsetting's bulk/interrupt endpoints before dropping them, so an endpoint absent from the target altsetting can't stay armed and hold its usbd claim. (No in-tree trigger: usbtest uses a single non-zero altsetting; defensive robustness for multi-alt vendor devices.) - vendor_device tud_vendor_n_mounted(): count iso endpoints too, so an iso-only altsetting reports mounted. (No in-tree trigger: usbtest alt1 always has bulk.) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-07Add core SuperSpeed device supporthathach
Groundwork for TinyUSB's first SuperSpeed port (WCH CH569): - TUSB_SPEED_SUPER, OPT_MODE_SUPER_SPEED, TUD_OPT_SUPER_SPEED and TUP_RHPORT_SUPERSPEED capability plumbing - Allow CFG_TUD_ENDPOINT0_SIZE 512 on SS builds; EP0 control transfers chunk at the runtime link speed (512 at SS, 64 on USB2 fallback) - Handle SET_SEL, SET_ISOCH_DELAY and U1/U2_ENABLE feature requests - Tolerate SS endpoint companion descriptors in usbd_open_edpt_pair, cdcd_open and mscd_open interface parsing - SS descriptor types/structs and template macros: endpoint companion, BOS USB2-extension + SuperSpeed capability, SS config and CDC/MSC/vendor SS variants (bulk fixed at 1024) - cdc_msc example: SS device/config/BOS descriptors, speed-aware sizes - Unit tests: SS endpoint validation, companion-tolerant endpoint pair open, SET_SEL, SET_ISOCH_DELAY All SS paths compile out when disabled: verified 0-byte code-size delta on stm32f407disco (MinSizeRel) vs master; 65/65 unit tests pass. Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-07address review round 2 (4 fixed, 1 answered)hathach
- dcd(nrf5x): dcd_edpt_iso_activate drops a stale armed transfer (started/ data_received/iso_in_transfer_ready) — there is no dcd close on this port, so a transfer armed before SET_INTERFACE would trip TU_ASSERT(!xfer->started) on the class's next arm after usbd reset the endpoint's claim state. - class(vendor): tud_vendor_n_mounted() counts the interrupt endpoints, so an interrupt-only vendor interface (bulk absent) reports mounted. - example(usbtest): int/iso write lengths follow the negotiated speed (tud_speed_get), not the compile-time capability — a high-speed build enumerated at full speed serves the FS descriptor (mps 64/128) and must not submit HS-sized packets. - test/hil: test_example() return annotation matches the (err, status, metric) 3-tuple it returns. Verified: feather_nrf52840_express and raspberry_pi_pico 30/30 through the HIL battery; pico/feather/ch32v307-usbhs builds clean. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-07address Codex/Copilot review findings (9 fixed, 3 refuted with evidence)hathach
- dcd(rp2040): rewind IN staging before the clear-halt re-issue. Staging advances user_buf/remaining_len when packets are copied into DPRAM, before the host has consumed them; aborting and re-issuing from the advanced pointer silently skipped the staged-but-unsent bytes. - dcd(ip3511): dcd_edpt_iso_activate aborts a transfer still armed from the previous altsetting (clear Active on both buffer slots) so the hardware can't keep servicing the old descriptor against the class's fresh queueing. - dcd(rusb2): reuse an endpoint's existing pipe in dcd_edpt_open. usbd_edpt_close is a no-op on ISO_ALLOC ports, so a class's close/open across SET_INTERFACE would allocate a second pipe with the same EPNUM and leak pipes. - class(vendor): the buffered-mode free-slot check also tests the interrupt endpoints, so an interrupt-only vendor interface isn't clobbered as "free". - bsp(ch32v30x): board_get_unique_id respects max_len and copies bytes (alignment-safe) instead of writing 12 bytes through a uint32_t cast. - test/hil/usbtest.py: treat same-serial multi-matches as ambiguous and retry until the dual-port stale node drops (nanoch32v203/ch32v307 variants); reprobe a binding that predates the dynamic-id re-registration so a stale capability profile can't survive; skip the remove_id/unbind cleanup after an unrecovered kernel-side hang (it would join the D-state convoy and deadlock the bus). - usbtest skip.txt: add the families whose DCD refuses dcd_edpt_iso_alloc (CXD56, FT90X, LPC175X_6X, LPC40XX, NUC100/120/505, PIC32MZ, SAMG, SAMX7X, VALENTYUSB_EPTRI) — tier 4 cannot enumerate there. - test/hil/tinyusb-sudoer: note that '#1000' is a sudoers UID specifier, not a comment (the review misread the grants as commented out). Refuted in review threads: nrf5x ISOSPLIT keeps reserve-max per-configuration allocation semantics (iso_alloc is per-config, not per-alt); the LPC EP-number claim (default descriptor uses EP1-3; lpcxpresso11u37 passes 30/30 on HW); the vendor alt-0 "abort" concern (host cannot address endpoints outside the active altsetting; usbd_edpt_iso_activate resets state on re-entry). Verified on hardware: raspberry_pi_pico, lpcxpresso11u37, ra4m1_ek all 30/30 through the HIL battery after the changes; builds clean incl. buffered-mode vendor (webusb_serial). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-06fix CI: clang/IAR unused helpers, LTO-dropped ISR symbol, LPC11/13 USB RAM ↵hathach
overflow Four PR-CI failures, each with a distinct root cause: - class/vendor: mark the shared non-buffered transfer helpers TU_ATTR_UNUSED. In buffered mode with the int/iso endpoint gates off none is referenced, and clang (-Wunused-function -Werror) and IAR (Error[Pe177]) reject an unused static — gcc does not, which is why only the clang/IAR matrix failed. - bsp/ch32v20x: keep dcd_int_handler alive under LTO. The `call` sits inside naked asm where LTO cannot see it, so -flto make builds internalized the symbol and every ch32v20x device example failed to link (cmake has no LTO, which masked it). A TU_ATTR_USED function-pointer reference pins it. - usbtest: LPC11/13 (ip3511 FS) keep endpoint buffers in a dedicated 2 KB USB RAM; the 2048 B bulk epbuf overflowed it (RamUsb2 150%) in make builds. Use 512 B (= 8 FS packets) on those parts; lpcxpresso11u37 still passes 30/30. - test/hil: skip device/usbtest on lpcxpresso43s67 (hfp rig) — its ip3511 HS port wedges from the first control case (1/30) and needs on-rig debugging. Verified: make builds link for nanoch32v203 (dfu_runtime + usbtest), lpcxpresso11u37 and lpcxpresso1347 (RamUsb2 75%); buffered-mode webusb_serial builds; 61/61 unit tests; lpcxpresso11u37 usbtest 30/30 on hardware with the smaller epbuf. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-06Merge remote-tracking branch 'origin/master' into usbtesthathach
# Conflicts: # lib/rt-thread/port/msc_device_port.c # src/device/usbd.c
2026-07-06usbtest: address remaining review findings (rusb2 #11/#12, vendor #15)hathach
#12 dcd(rusb2): key the bulk-OUT clear-stall re-arm on a new per-pipe `queued` flag instead of `pipe.buf != NULL`. A zero-length OUT read leaves buf==NULL while still armed, so the old test skipped the re-assert and the endpoint NAKed forever after CLEAR_FEATURE(HALT). `queued` is set at submit and cleared at completion (and on pipe teardown). #11 dcd(rusb2): retry a zero-length IN packet that couldn't be queued at submit (double-buffered pipe full, host not draining). Previously the ZLP was dropped and the next BRDY reported a phantom completion for a packet the host never received; now it's deferred to BRDY via `zlp_pending` and only completes once actually queued and sent. #15 vendor: collapse the byte-identical bulk/interrupt/isochronous non-buffered write / write_available / read_xfer triples into three shared static-inline helpers keyed on (endpoint, epbuf, bufsize). Verified on ra4m1_ek: usbtest tier-4 30/30 (rusb2 + vendor refactor); pre-commit (format/codespell/unit) clean. The nRF54LM20 DK also passes 30/30 at high speed. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-06usbtest: address code-review findings (EP3 iso regression + 9 more)hathach
Cross-checking the branch against the MCU datasheets surfaced a regression and several latent defects. Fixes (finding # from the review): #1 dcd_ch32_usbfs: restore EP3's enlarged iso buffer. CH32V20x/V30x/F20x USBFS give endpoint 3 a 1023-byte iso packet (CH32FV2x_V3xRM ch23; 16-bit R16_UEP3_T_LEN), unlike every other 64 B endpoint. Commit c05e9313e removed that buffer and capped iso at 64 B, breaking >64 B FS iso (UVC/UAC) on EP3. Re-add it via CFG_TUD_WCH_USBFS_EP3_BUFSIZE, defaulted to 1023 on those parts (CH32_USBFS_EP3_1023_BUFSIZE in ch32_usbfs_reg.h) and 64 elsewhere. #3 dcd_ch32_usbfs: make data.isochronous[] per-direction and clear it on endpoint (re)open, so a reused ep number can't inherit a stale iso response. #7 dcd_ch32_usbfs: exempt iso from the PID_OUT data-toggle handling too (was only done for PID_IN); iso is DATA0-only in both directions. #13 dcd_ch32_usbfs: bounds-assert ep < EP_MAX in dcd_edpt_iso_alloc. #2/#6 usbtest descriptors: TUD_OPT_HIGH_SPEED is a compile-time capability, not the live speed, so the full-speed config (and OTHER_SPEED) advertised int/iso mps 512 on HS boards — illegal at FS / over the 1023 B/frame iso budget. Split into FS-legal / HS descriptor sizes; the plain macro tracks operating speed. #10 vendor: non-alt free-slot detection also checks the int endpoints (a vendor interface may now be interrupt-only, no bulk ep). #14 vendor: replace the order-coupled ITF_MEM_RESET_SIZE ladder (2 unreachable branches) with offsetof(vendord_interface_t, tx_stream). #5 rp2040: clear_stall re-issue preserves the already-transferred count so a mid-transfer clear-halt reports the full length, not just the remainder. #8 rp2040: force single-buffering for iso (only BULK gets a double DPRAM buffer), so a multi-packet iso xfer can't spill buffer 1 into the next ep's DPRAM. Verified: CH32V203 usbfs and CH583 still pass usbtest tier-4 30/30; all board families build; pre-commit (format/codespell/unit) clean. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-05bound rndis data packet offset in handle_incoming_packetJavid Khan
Signed-off-by: Javid Khan <[email protected]>
2026-07-05Merge pull request #3738 from sauloverissimo/fix/midi2-fb-directionZixun LI
feat(midi2): derive function blocks from the GTB descriptor
2026-07-05ensure gtb is validHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-07-05Merge pull request #3754 from Old-Ding/codex/usbtmc-status-byte-bufferZixun LI
Fix USBTMC status byte interrupt buffer
2026-07-05Merge pull request #3741 from dxbjavid/ncm-ndp-length-boundZixun LI
bound ndp16 wLength against received ntb in recv_validate_datagram
2026-07-05Fix USBTMC status byte notification bufferaineoae86-sys
Queue the USB488 READ_STATUS_BYTE interrupt notification through tud_usbtmc_transmit_notification_data so it uses the class notification endpoint buffer for the asynchronous transfer. Fixes #2928 Generated-by: OpenAI Codex Signed-off-by: aineoae86-sys <[email protected]>
2026-07-05fix sizeof(nth16_t) typoHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-07-05Fix USBTMC notification endpoint claimaineoae86-sys
Use usbd_edpt_claim() before queuing USBTMC notification data so the interrupt endpoint is reserved through the normal endpoint ownership path. Release the claim if the notification payload cannot be copied before the transfer is queued. Fixes #2735 Generated-by: OpenAI Codex Signed-off-by: aineoae86-sys <[email protected]>
2026-07-03Merge pull request #3660 from andrewleech/cdch-on-enum-idx-guardZixun LI
cdc_host: fix undeclared 'idx' when only LINE_CONTROL_ON_ENUM is defined
2026-07-03class/audio: drop redundant clear_stall busy-clear workaround in set_interfacehathach
audiod_set_interface used usbd_edpt_clear_stall() on a non-stalled endpoint purely to drop a leftover BUSY bit ('THIS IS A WORKAROUND!'), from when ep_close() did not clear endpoint state. That premise no longer holds: by the time the workaround ran, the endpoint's ep_status (incl. BUSY) had already been zeroed - by usbd_edpt_close() on close-API ports (ip3511, rusb2) or by usbd_edpt_iso_activate() on iso-alloc ports - so the call was dead code. Verified: full audio_test capture works across stop/start streaming (arecord start -> stop -> restart, each delivering a complete buffer) on stm32f407disco (dwc2, working iso); 25 raw SET_INTERFACE alt1<->alt0 cycles leave the device responsive; behaviour is byte-identical with and without the workaround on metro_m4 (samd51, whose iso-IN stalls for a separate pre-existing reason); builds clean on iso-alloc (samd, dwc2) and close-API (lpc55, ra) ports. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03usbd/vendor/usbtest: address second-round review findingshathach
usbd: - usbd_edpt_clear_stall keeps the long-standing unconditional STALLED|BUSY clear (audio's set-interface relies on it to drop a leftover BUSY bit) and only gates the new CLAIMED release on the endpoint having been stalled — fixes the halt-test starvation without the double-arm race and without regressing audio on ports where nothing else zeros ep_status. - GET_STATUS direction guard + checked return factored into a shared process_get_status() and applied to all three recipients (device, interface, endpoint); previously only the interface case was hardened, leaving the endpoint/device siblings able to hand usbd a stack buffer for a malformed OUT request. vendor: - vendord_open commits p_itf_desc only after the descriptor parse succeeds, so a mid-parse failure no longer marks the interface slot permanently occupied (find_vendor_itf keys on p_itf_desc under ALT_SETTINGS). - vendord_set_alt is a single pass again: the current endpoints are dropped only once the target altsetting is confirmed present, dropping the redundant vendord_has_alt pre-scan while keeping the invalid-alt rollback. - CLOSE_API iso re-activation now closes+reopens the endpoint (zeroing ep_status) instead of a no-op, so a re-selected altsetting on ip3511/rusb2 can't starve on stale BUSY/CLAIMED. test/hil/usbtest.py: - re-resolve on the concrete serial (never retarget a different device), best-effort cleanup that can't mask the original error, set_pattern catches PermissionError too, --tier choices derive from TIER_CASES, --tests uses isdecimal. Full 30-case battery passes on all four dwc2 boards; all three GET_STATUS recipients + invalid SET_INTERFACE + EP0 halt verified via raw usbfs control transfers; usbtest builds for ip3511/rusb2 (CLOSE_API iso path). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03class/vendor: portability + robustness fixes for int/iso/alt supporthathach
- Isochronous endpoints are reserved through TUP_DCD_EDPT_ISO_ALLOC-guarded helpers with a usbd_edpt_open fallback (mirrors audio), so ports without the iso alloc API (lpc_ip3511, rusb2) enumerate instead of failing open. - #error when EP_ISO_* is set without ALT_SETTINGS (iso must live in a non-zero altsetting per USB 2.0 5.6.3); the non-alt open path no longer silently treats an iso endpoint as bulk. - Non-buffered bulk read/write gain the 'ep > 0' guard the int/iso APIs have, so they cannot claim EP0 while an altsetting without a bulk ep is selected. - find_vendor_itf uses p_itf_desc (not the ep fields) to detect a free slot under ALT_SETTINGS, where an interface parked in the empty alt 0 has all ep fields 0; fixes slot aliasing with CFG_TUD_VENDOR > 1. - vendord_set_alt validates the altsetting exists before mutating state (rollback safety) and stall/clears interrupt endpoints only for the enabled direction. - vendord_open rejects an endpoint address reused across altsettings with a different type/MPS (opened once), closing a misconfig + buffer overflow. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02class/vendor: isochronous endpoints + alternate setting supporthathach
CFG_TUD_VENDOR_EP_ISO_OUT/IN (default 0) add an isochronous endpoint per direction with the same non-buffered API shape as the interrupt pair (tud_vendor_n_iso_read_xfer / tud_vendor_n_iso_write + weak iso_rx/tx_cb), buffers sized by CFG_TUD_VENDOR_EP_ISO_OUT/IN_BUFSIZE. CFG_TUD_VENDOR_ALT_SETTINGS (default 0, non-buffered mode only) lets the vendor interface carry multiple altsettings: vendord consumes them all, answers GET_INTERFACE and performs SET_INTERFACE via a new internal vendord_control_xfer_cb (registered in usbd's driver table; everything else still delegates to the app's tud_vendor_control_xfer_cb). Endpoints are hardware-opened exactly once at vendord_open: dcds with a linear FIFO allocator (dwc2: TUP_DCD_EDPT_ISO_ALLOC, where usbd_edpt_close is a no-op and every re-open leaks FIFO space) cannot close/re-open endpoints dynamically. Selecting an altsetting only re-targets the API: bulk/interrupt endpoints get a stall+clear-stall cycle, which portably aborts any in-flight transfer and resets the data toggle to DATA0 as SET_INTERFACE requires; isochronous endpoints are FIFO-allocated at open and (re)activated on selection. Motivated by the usbtest example (Linux usbtest iso cases 15/16/22/23, which also drives 256 consecutive SET_INTERFACE cycles in its ch9 case); alt 0 without endpoints satisfies USB 2.0 5.6.3 for iso devices. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02class/vendor: optional interrupt endpoints (CFG_TUD_VENDOR_EP_INT_OUT/IN)hathach
The vendor interface may carry an interrupt OUT and/or interrupt IN endpoint alongside the bulk pair, each direction gated separately by CFG_TUD_VENDOR_EP_INT_OUT / CFG_TUD_VENDOR_EP_INT_IN (default 0, no cost when disabled) with CFG_TUD_VENDOR_EP_INT_OUT_BUFSIZE / CFG_TUD_VENDOR_EP_INT_IN_BUFSIZE (default 64) sizing the dedicated endpoint buffers; endpoint max packet size is checked at open. Interrupt endpoints are non-buffered: tud_vendor_n_int_read_xfer() arms the OUT endpoint one packet at a time (delivered via the new weak tud_vendor_int_rx_cb, no automatic re-arm), tud_vendor_n_int_write() is a direct transfer completing into tud_vendor_int_tx_cb. Motivated by the usbtest example (Linux usbtest interrupt cases 25/26) but generally useful for vendor protocols with a side channel. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
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-28feat(midi2): derive function blocks from the GTB descriptorSaulo Veríssimo
Function Block Info (direction, group span, name) is derived from the GTB descriptor as the single source of truth, so a device can expose multiple Group Terminal Blocks with independent directions. Adds Function Block Name notifications (tud_midi2_fb_name_cb) and an opt-in callback to answer UMP Stream messages from the application (tud_midi2_stream_msg_cb). Ref #3571
2026-06-27bound ndp16 wLength against received ntb in recv_validate_datagramJavid Khan
2026-06-24cap tud_msc_scsi_cb bufsize to endpoint buffer sizedxbjavid
2026-06-23Merge pull request #3698 from dxbjavid/hid-report-desc-boundsZixun LI
bound item size to remaining length in hid report descriptor parser
2026-06-19video: assert usbd_edpt_iso_activate() result in _open_vs_itf()hathach
The isochronous streaming endpoint was activated with the usbd_edpt_iso_activate() return value ignored, unlike every neighbouring open in the same function (usbd_edpt_open() is wrapped in TU_ASSERT on both the non-ISO-alloc fallback and the bulk branch). When a DCD refuses the iso endpoint -- e.g. it has no isochronous support, or the requested packet size does not fit its endpoint buffers -- that failure was silently swallowed and the alternate setting was reported as opened, leaving the host streaming to an endpoint the device never armed. Wrap it in TU_ASSERT so the open fails cleanly and the refusal propagates, matching the adjacent endpoint-open calls. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-19Merge pull request #3709 from morse-cedricvandenbergh/ncm-default-link-state-cbZixun LI
ncm: add weak callback for initial link state
2026-06-18class/audio: remove unused audio20_control_request_thathach
After the UAC2 examples switched to tusb_control_request_t with TU_U16_HIGH/LOW() extraction, audio20_control_request_t is no longer referenced anywhere in the tree. It is a byte-overlay of the setup packet whose bChannelNumber/bControlSelector/bInterface/bEntityID sub-byte fields silently misread on big-endian once wValue/wIndex are converted to host order (tu_le16toh in dcd.h), so leaving it in the public header is a latent BE trap; the BE bitfield guard previously added to its bmRequestType_bit only masked that by guarding byte 0. Drop the struct entirely. Callers should use tusb_control_request_t and TU_U16_LOW/HIGH(wValue|wIndex), matching audio_device.c and the examples. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-06-18Merge remote-tracking branch 'origin/master' into pr-3618hathach
2026-06-16ncm: add weak callback for initial link stateCedric Van den Bergh
netd_init resets link_is_up to a compile-time default, which is incorrect when the host reboots without power-cycling the device. Add tud_network_default_link_state_cb() so applications can return the actual physical link state. The weak default preserves existing CFG_TUD_NCM_DEFAULT_LINK_UP behaviour.
2026-06-15zero-extend usage page before copying shorter payloaddxbjavid
2026-06-12bound item size to remaining length in hid report descriptor parserdxbjavid
2026-06-06host/cdc: use local control bufferHiFiPhile
2026-06-03refactor(cmake): comment out unused target folder propertieshathach
2026-05-31cdc_host: fix undeclared 'idx' when only LINE_CONTROL_ON_ENUM definedAndrew Leech
idx is used in the ENUM_SET_LINE_CONTROL path guarded by CFG_TUH_CDC_LINE_CONTROL_ON_ENUM, but was declared only under CFG_TUH_CDC_LINE_CODING_ON_ENUM. Defining LINE_CONTROL_ON_ENUM without LINE_CODING_ON_ENUM therefore failed to compile with an undeclared identifier. Guard the declaration under either macro. Signed-off-by: Andrew Leech <[email protected]>
2026-05-30Merge pull request #3658 from wjklimek1/mtp-out-transfer-fixZixun LI
Fix premature MTP phase change after short MTP OUT transfer
2026-05-29Handle OUT transfer completion in MTPWojciech Klimek
Handle OUT transfer differently from IN to not prematurely change MTP phase when host sends short packet that is not end of MTP data phase. Only reaching container length or ZLP should change phase.
2026-05-25chore: resolve .gitignore merge conflict with mastercopilot-swe-agent[bot]
Co-authored-by: HiFiPhile <[email protected]>
2026-05-19midi2_host: convert TX to raw FIFO mirroring midi2_device refactorSaulo Veríssimo
2026-05-18midi2: convert to raw Tx FIFO for better segmentation handling, add count to ↵HiFiPhile
packet api Signed-off-by: HiFiPhile <[email protected]>
2026-05-18midi2: boundary-aware drain in xfer_cb to keep UMP packets intactSaulo Veríssimo
2026-05-17midi2: drain pattern for RX FIFOSaulo Veríssimo
Default RX/TX buffers to EPSIZE for both device and host. Document drain-in-loop on ump_read; example device callback drains until empty.
2026-05-17midi2: scale device buffers with EPSIZESaulo Veríssimo
Match midi2_host pattern. Literal 256 underran HS endpoints (512B).
2026-05-17midi2: per-interface weak callbacks for UMP Stream configSaulo Veríssimo
Lets each instance return different NUM_GROUPS, NUM_FUNCTION_BLOCKS, EP_NAME and PRODUCT_ID. Defaults fall back to the macros.
2026-05-17midi2: peek 4 bytes for MT, restore 256 buffersSaulo Veríssimo
MT is in byte 3 of the UMP word in LE memory, not byte 0. Buffers at mps blocked RX xfer re-arm on partial packets.