summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-12-10 19:26:57 +0700
committerGitHub <[email protected]>2025-12-10 19:26:57 +0700
commitb05ec753f8aa8607b6e72ec7e3933935094e6906 (patch)
tree1966bfcbc999b933b4b5ccf6ea3fe6515d0b8bd6 /src
parent098dd07ecd204c47c6fa72b078b085d16413f48c (diff)
parent7e70f0b07cd3b52eecdfdd51d0360772f5ba7131 (diff)
Merge pull request #3401 from hathach/copilot/fix-mtp-device-bug
Fix MTP transfer completion detection for exact-length packets
Diffstat (limited to 'src')
-rw-r--r--src/class/mtp/mtp_device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/class/mtp/mtp_device.c b/src/class/mtp/mtp_device.c
index 764019e42..4942a105a 100644
--- a/src/class/mtp/mtp_device.c
+++ b/src/class/mtp/mtp_device.c
@@ -422,10 +422,10 @@ bool mtpd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t
cb_data.total_xferred_bytes = p_mtp->xferred_len;
bool is_complete = false;
- // complete if ZLP or short packet or overflow
+ // complete if ZLP or short packet or total length reached
if (xferred_bytes == 0 || // ZLP
(xferred_bytes & (bulk_mps - 1)) || // short packet
- p_mtp->xferred_len > p_mtp->total_len) {
+ p_mtp->xferred_len >= p_mtp->total_len) { // total length reached
is_complete = true;
}