summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-04 15:31:45 +0700
committerhathach <[email protected]>2026-06-04 15:31:45 +0700
commit0393a5eaa1fc9ef33cbfd847c924cb83d82696f3 (patch)
treeb96374c05142757820304e2d89d6f260b24f1354 /src/class
parent232315d6909d9ca7948c830a5e43ad35189da57f (diff)
parentac32feafeb2fb0f6cc5c3010d32db319ff15ca64 (diff)
Merge branch 'master' into dwc2_postfix
Diffstat (limited to 'src/class')
-rw-r--r--src/class/mtp/mtp_device.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/class/mtp/mtp_device.c b/src/class/mtp/mtp_device.c
index fd06b4601..1f76dfcc7 100644
--- a/src/class/mtp/mtp_device.c
+++ b/src/class/mtp/mtp_device.c
@@ -443,15 +443,12 @@ bool mtpd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t
// Check completion for IN and OUT separately
bool is_complete;
-
- if (is_data_in)
- {
+ if (is_data_in) {
// IN completion: short packet, ZLP, or reaching total_len
is_complete = (xferred_bytes == 0 || xferred_bytes < threshold || p_mtp->xferred_len >= p_mtp->total_len);
- }
- else
- {
- // OUT completion: reaching total_len or ZLP
+ } else {
+ // OUT completion: reaching total_len or ZLP only. A short packet does NOT end the phase
+ // (an early short packet before total_len is the cancel case, not normal completion).
is_complete = (p_mtp->xferred_len >= p_mtp->total_len) || ((xferred_bytes == 0 && p_mtp->xferred_len > 0));
}