| Age | Commit message (Collapse) | Author |
|
The data-out phase ended before its terminating ZLP and before the
application had seen the final payload, and several transaction states
had no way back to idle. Reworked as one state machine:
- Add MTP_PHASE_DATA_COMPLETE, entered once the data phase has fully
finished - for an exact buffer-multiple data-out, only after the
host's terminating ZLP - and deliver tud_mtp_data_complete_cb() from
there. tud_mtp_response_send() now refuses while the phase is still
MTP_PHASE_DATA: ep_out still owes the host a read at that point and
re-arming it for a new command would race that read.
- Arm the terminating-ZLP read before handing the final payload to the
application, as the IN path already does. The 0-length read passes a
NULL buffer so the payload is untouched, and claiming ep_out first
means a late tud_mtp_data_receive() fails its own claim instead of
breaking the driver's next step.
- Honor the documented negative return of tud_mtp_data_xfer_cb() and
tud_mtp_data_complete_cb() by entering MTP_PHASE_ERROR, which stalls
both endpoints. This is the application's way out of a data phase now
that a response cannot be sent from one. Their weak stubs return 0 so
an application that does not implement them is unaffected.
- Take total_len from the container header the host sends on the first
OUT packet. The application can only set it up front when it knows
the size (SendObject); SendObjectInfo cannot, so total_len kept the
12-byte header default and the phase ended on the first packet.
- Reject a runt or misdirected container in both the command and data
phases: a short packet was matched against stale buffer contents, and
the failed TU_VERIFY left ep_out neither armed nor stalled. The
first data-out packet previously underflowed payload_bytes instead.
- Restore the previous phase when tud_mtp_data_send()/_receive() cannot
claim their endpoint, so the application's fallback response is not
refused by a phase the driver never actually entered.
- Re-arm ep_out after MTP_REQ_CANCEL of a data phase, and defer the
new-command read when ep_out is still busy with the ZLP read of an
abandoned transaction: usbd_edpt_xfer() asserts on a busy endpoint,
so MTP_REQ_RESET could not recover.
The MTP example follows the same contract: a handler error raised mid
data phase (fs_send_object_info validates the received ObjectInfo, so
STORE_FULL and INVALID_PARENT_OBJECT can only be raised there) is kept
and answered from tud_mtp_data_complete_cb() once the phase completes.
|
|
|
|
|
|
|
|
|
|
bound cdc-data endpoints against descriptor length in acm_open
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
vendord_set_alt() aborted bulk/interrupt endpoints of the outgoing
altsetting (stall/clear-stall) but only dropped the iso endpoints'
tracking: an armed iso transfer stayed live in the dcd with its usbd
claim held and no tracked handle to stop it, and its completion fired
into an endpoint the class no longer recognizes. Reachable through the
usbtest example's alt0 (bulk) <-> alt1 (iso) SET_INTERFACE switching.
Track each selected iso endpoint's descriptor (points into the app's
static descriptor set) and deactivate on de-selection: with the
iso-alloc API re-activation is the abort/scrub primitive (resets
ep_status, aborts the stale transfer); without it usbd_edpt_close does,
and the next selection re-opens. Iso cannot be stalled like
bulk/interrupt, hence the separate path.
Build-verified: usbtest for stm32f072disco, ra4m1_ek, raspberry_pi_pico
(iso-alloc) and ch32v307v_r1_1v0 (close API).
|
|
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
|
|
Non-buffered per-type source/sink endpoints (bulk/int/iso) with manual RX
arming across altsettings.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
|
|
add a three-level TUSB_VALIDATION_NONE/BASIC/STRICT knob and default
CFG_TUH_VALIDATION_LEVEL to BASIC, then make acm_open the first user so
the enumeration bounds checks compile out at NONE for trusted-device
setups and stay on by default.
|
|
Signed-off-by: Javid Khan <[email protected]>
|
|
feat(midi2): derive function blocks from the GTB descriptor
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
Fix USBTMC status byte interrupt buffer
|
|
bound ndp16 wLength against received ntb in recv_validate_datagram
|
|
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]>
|
|
|
|
Signed-off-by: HiFiPhile <[email protected]>
|
|
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]>
|
|
|
|
|
|
cdc_host: fix undeclared 'idx' when only LINE_CONTROL_ON_ENUM is defined
|
|
|
|
* 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.
|
|
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
|
|
|
|
|
|
bound item size to remaining length in hid report descriptor parser
|
|
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]>
|
|
ncm: add weak callback for initial link state
|
|
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]>
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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]>
|
|
Fix premature MTP phase change after short MTP OUT transfer
|
|
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.
|
|
Co-authored-by: HiFiPhile <[email protected]>
|
|
|
|
packet api
Signed-off-by: HiFiPhile <[email protected]>
|
|
|
|
Default RX/TX buffers to EPSIZE for both device and host. Document
drain-in-loop on ump_read; example device callback drains until
empty.
|
|
Match midi2_host pattern. Literal 256 underran HS endpoints (512B).
|
|
Lets each instance return different NUM_GROUPS, NUM_FUNCTION_BLOCKS,
EP_NAME and PRODUCT_ID. Defaults fall back to the macros.
|