<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tinyusb.git/src/class/mtp/mtp_device.h, 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/mtp/mtp_device.h?h=claude%2Fmtp-data-phase-fixes</id>
<link rel='self' href='http://cgit.235523.xyz/tinyusb.git/atom/src/class/mtp/mtp_device.h?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>license: use SPDX identifiers for src/ headers (#3749)</title>
<updated>2026-07-02T14:55:45Z</updated>
<author>
<name>Ha Thach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2026-07-02T14:55:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=7a4111b96ef6279e75579f9a18443834f6a0871d'/>
<id>urn:sha1:7a4111b96ef6279e75579f9a18443834f6a0871d</id>
<content type='text'>
* 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.</content>
</entry>
<entry>
<title>mtp: fix adding empty cstring to mtp_container_info</title>
<updated>2026-03-25T08:43:48Z</updated>
<author>
<name>stepan chepushtanov</name>
<email>s.chepushtanov@is.local</email>
</author>
<published>2026-03-05T06:43:37Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=a64a8579c5bc25ffbe73da55f8431fab6835f3de'/>
<id>urn:sha1:a64a8579c5bc25ffbe73da55f8431fab6835f3de</id>
<content type='text'>
</content>
</entry>
<entry>
<title>minor update</title>
<updated>2026-02-07T11:01:23Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2026-02-07T11:01:23Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=25de49f8f6e8590eb548d4016e030d19166b9fb3'/>
<id>urn:sha1:25de49f8f6e8590eb548d4016e030d19166b9fb3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>added .clang-format</title>
<updated>2025-11-05T10:34:27Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-11-05T08:31:02Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=1f04fe7924e8777c1583323171c0e1cabcb29062'/>
<id>urn:sha1:1f04fe7924e8777c1583323171c0e1cabcb29062</id>
<content type='text'>
fix more alerts
disable IAR CStat since pvs-studio check is better integrated with clion
</content>
</entry>
<entry>
<title>refactor mtp examples, add phase and session id to callback data</title>
<updated>2025-09-29T08:08:12Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-09-29T08:02:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=4f3a5f92fa21307b1f1c9700cd041e945a627f63'/>
<id>urn:sha1:4f3a5f92fa21307b1f1c9700cd041e945a627f63</id>
<content type='text'>
</content>
</entry>
<entry>
<title>implement control request</title>
<updated>2025-09-27T10:08:21Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-09-27T09:15:04Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=cb21ca1b0cb3221341dca2559109c0bb4dc18e6f'/>
<id>urn:sha1:cb21ca1b0cb3221341dca2559109c0bb4dc18e6f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>implement tud_mtp_mounted() and tud_mtp_event_send()</title>
<updated>2025-09-26T08:52:37Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-09-26T08:52:37Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=f9d4bc798177e63532cd5a2ef058400d6f0ef5e4'/>
<id>urn:sha1:f9d4bc798177e63532cd5a2ef058400d6f0ef5e4</id>
<content type='text'>
refactor phase state
</content>
</entry>
<entry>
<title>fix more ci build</title>
<updated>2025-09-26T04:51:09Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-09-26T04:51:09Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=e92262eb5cdc35dfc6019c97d1b9166be0f5e62f'/>
<id>urn:sha1:e92262eb5cdc35dfc6019c97d1b9166be0f5e62f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>implement send object command, able to create new file</title>
<updated>2025-09-25T10:47:50Z</updated>
<author>
<name>hathach</name>
<email>thach@tinyusb.org</email>
</author>
<published>2025-09-25T10:43:25Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/tinyusb.git/commit/?id=c9a8330081b59c05b901889d405ed7b9648c0947'/>
<id>urn:sha1:c9a8330081b59c05b901889d405ed7b9648c0947</id>
<content type='text'>
</content>
</entry>
</feed>
