<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tinyusb.git/src/class, branch claude/mtp-data-phase-fixes</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/tinyusb.git/atom/src/class?h=claude%2Fmtp-data-phase-fixes</id>
<link rel='self' href='http://cgit.235523.xyz/tinyusb.git/atom/src/class?h=claude%2Fmtp-data-phase-fixes'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/'/>
<updated>2026-08-17T05:11:53Z</updated>
<entry>
<title>class/mtp: correct data phase completion and transaction recovery</title>
<updated>2026-08-17T05:11:53Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2026-08-13T07:34:58Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=5a9803555f362a0efeeb549093a3338c5b151e9c'/>
<id>urn:sha1:5a9803555f362a0efeeb549093a3338c5b151e9c</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'tinyusb/master' into fix/lpc43-hfp-reliability</title>
<updated>2026-07-29T14:08:26Z</updated>
<author>
<name>Zixun LI</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-29T14:08:26Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=1b628e3fb581d56639fac9287448203db7d10ff1'/>
<id>urn:sha1:1b628e3fb581d56639fac9287448203db7d10ff1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>class/mtp: preserve final OUT payload before ZLP</title>
<updated>2026-07-28T22:34:59Z</updated>
<author>
<name>Zixun LI</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-28T22:34:59Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=3e3e9f8a978b274b8fe1f5a9b5fd41a94f928606'/>
<id>urn:sha1:3e3e9f8a978b274b8fe1f5a9b5fd41a94f928606</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Address Codex feedback on spelling</title>
<updated>2026-07-27T22:48:59Z</updated>
<author>
<name>Anthony VerBurg</name>
<email>anthony@modretro.com</email>
</author>
<published>2026-07-27T22:48:59Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=9bcc2dc25ceb21a54aedb2a57088943b630fba24'/>
<id>urn:sha1:9bcc2dc25ceb21a54aedb2a57088943b630fba24</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add more HID Usage Page enums</title>
<updated>2026-07-22T17:57:39Z</updated>
<author>
<name>Anthony VerBurg</name>
<email>anthony@modretro.com</email>
</author>
<published>2026-07-22T17:57:39Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=2d013717a47e7535e1c0663b0300c65b838842d8'/>
<id>urn:sha1:2d013717a47e7535e1c0663b0300c65b838842d8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge pull request #3750 from dxbjavid/cdc-acm-open-desc-bounds</title>
<updated>2026-07-19T20:01:11Z</updated>
<author>
<name>Zixun LI</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-19T20:01:11Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=52e6ab7704ce2e57f41f70d6ba2bc5470c4b56c7'/>
<id>urn:sha1:52e6ab7704ce2e57f41f70d6ba2bc5470c4b56c7</id>
<content type='text'>
bound cdc-data endpoints against descriptor length in acm_open</content>
</entry>
<entry>
<title>add interface desc length check</title>
<updated>2026-07-19T19:11:12Z</updated>
<author>
<name>HiFiPhile</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-19T19:11:12Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=17aee71c1105763e99248737532411a936703f47'/>
<id>urn:sha1:17aee71c1105763e99248737532411a936703f47</id>
<content type='text'>
Signed-off-by: HiFiPhile &lt;admin@hifiphile.com&gt;
</content>
</entry>
<entry>
<title>improve validation structure</title>
<updated>2026-07-19T19:01:43Z</updated>
<author>
<name>HiFiPhile</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-19T18:39:02Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=1c3470a71e3755e6919cb7bd1a5d07f1985c8bb9'/>
<id>urn:sha1:1c3470a71e3755e6919cb7bd1a5d07f1985c8bb9</id>
<content type='text'>
Signed-off-by: HiFiPhile &lt;admin@hifiphile.com&gt;
</content>
</entry>
<entry>
<title>improve pointer arithmetic, check funmctional descriptor bLength</title>
<updated>2026-07-19T18:30:08Z</updated>
<author>
<name>HiFiPhile</name>
<email>admin@hifiphile.com</email>
</author>
<published>2026-07-19T18:30:08Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=ea88d2f530e11702a7bfc5aa882e8e659a677681'/>
<id>urn:sha1:ea88d2f530e11702a7bfc5aa882e8e659a677681</id>
<content type='text'>
Signed-off-by: HiFiPhile &lt;admin@hifiphile.com&gt;
</content>
</entry>
<entry>
<title>vendor: deactivate de-selected altsetting's isochronous endpoints</title>
<updated>2026-07-17T05:07:50Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2026-07-17T05:07:50Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=a68d776ac072725266ab53b64b29d4405090281f'/>
<id>urn:sha1:a68d776ac072725266ab53b64b29d4405090281f</id>
<content type='text'>
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) &lt;-&gt; 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).
</content>
</entry>
</feed>
