Open
Description
Certainly a bug:
At the file transfer such statement calculates buffer size in a wrong way. It always 12 bytes since the header is always less than Header+data.
I offer to remove this line and to invoke as
(void)USBD_LL_Transmit(pdev, MTPInEpAdd, buf, len);
Because at file transfer there might be a situation when there is no header and the last packet of data has length 0-12 bytes.
The second bug is on the:
It invokes the function that writes into buffer and sets it size.
But at line:
We overwrite this buffer with 12 byte header at the start of the file transfer thus corrupts 12 bytes of provided data in the buffer.
I offer to change line 109 with:
(void)((USBD_MTP_ItfTypeDef *)pdev->pUserData[pdev->classId])->ReadData(hmtp->OperationsContainer.Param1, (uint8_t *)data_buff+MTP_CONT_HEADER_SIZE, &MTP_DataLength);
As a result move the pointer by 12 bytes and write buffer in the right section
And it is good to notice in ReadData comments that it should return buffer with size 52 at the first invocation,should return 64 bytes at intermediate, and 0-63bytes meaning the last transfer
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
To release