summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-09-27 18:28:11 +0700
committerhathach <[email protected]>2025-09-27 18:28:11 +0700
commitbc688ccbad78053ee47306307a91e8f2d9d51e38 (patch)
tree1c507a16ced15679f8850077a145571b752ec852
parentadce3bbac02f81c0e7e17f4fcbd1deb83bef7cb4 (diff)
add edpt claim for public API
-rw-r--r--src/class/mtp/mtp_device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/class/mtp/mtp_device.c b/src/class/mtp/mtp_device.c
index a72712795..86d18a942 100644
--- a/src/class/mtp/mtp_device.c
+++ b/src/class/mtp/mtp_device.c
@@ -218,6 +218,7 @@ static bool mtpd_data_xfer(mtp_container_info_t* p_container, uint8_t ep_addr) {
const uint16_t xact_len = tu_min16((uint16_t) (p_mtp->total_len - p_mtp->xferred_len), CFG_TUD_MTP_EP_BUFSIZE);
if (xact_len) {
// already transferred all bytes in header's length. Application make an unnecessary extra call
+ TU_VERIFY(usbd_edpt_claim(p_mtp->rhport, ep_addr));
TU_ASSERT(usbd_edpt_xfer(p_mtp->rhport, ep_addr, _mtpd_epbuf.buf, xact_len));
}
return true;
@@ -236,8 +237,8 @@ bool tud_mtp_response_send(mtp_container_info_t* p_container) {
p_mtp->phase = MTP_PHASE_RESPONSE;
p_container->header->type = MTP_CONTAINER_TYPE_RESPONSE_BLOCK;
p_container->header->transaction_id = p_mtp->command.transaction_id;
- TU_ASSERT(usbd_edpt_xfer(p_mtp->rhport, p_mtp->ep_in, _mtpd_epbuf.buf, (uint16_t)p_container->header->len));
- return true;
+ TU_VERIFY(usbd_edpt_claim(p_mtp->rhport, p_mtp->ep_in));
+ return usbd_edpt_xfer(p_mtp->rhport, p_mtp->ep_in, _mtpd_epbuf.buf, (uint16_t)p_container->header->len);
}
bool tud_mtp_mounted(void) {
@@ -250,7 +251,6 @@ bool tud_mtp_event_send(mtp_event_t* event) {
TU_VERIFY(p_mtp->ep_event != 0);
_mtpd_epbuf.buf_event = *event;
TU_VERIFY(usbd_edpt_claim(p_mtp->rhport, p_mtp->ep_event)); // Claim the endpoint
-
return usbd_edpt_xfer(p_mtp->rhport, p_mtp->ep_event, (uint8_t*) &_mtpd_epbuf.buf_event, sizeof(mtp_event_t));
}