Media Transfer Protocol Porting Kit
| Layer | Description | |-------|-------------| | | Handles USB endpoint read/write, interrupt events, and session management. | | Command Processor | Parses MTP operation codes, validates parameters, invokes handlers. | | Object Manager | Interfaces with file system (FAT, exFAT, SPIFFS) to create/read/delete/rename objects. | | Property Provider | Maps standard MTP properties (e.g., StorageID , ObjectFormat ) to device metadata. |
While primarily for developers, users sometimes need the kit to fix driver issues or for simulation. MTP Responder Development Guide
MTP: Received CMD_GET_OBJECT_INFO (0x1005) MTP: Responding with 32-byte object info MTP: Bulk OUT transfer completed, 2048 bytes written to /sdcard/DCIM/photo.jpg
bool mtp_usb_send(const uint8_t* data, uint32_t len); bool mtp_usb_recv(uint8_t* buf, uint32_t timeout_ms); void mtp_usb_attach(void); // Notify host of device availability
Why was this shift necessary?
void mtp_send_event(uint16_t event_code, uint32_t param1);
The kit typically includes:
| RTOS Feature | Usage | |--------------|-------| | Mutex | Protect object list during concurrent host access | | Message queue | Deliver USB events to MTP task | | Semaphore | Block waiting for MTP response when acting as initiator |
For a developer, the journey with the Porting Kit typically follows a structured path:
| Layer | Description | |-------|-------------| | | Handles USB endpoint read/write, interrupt events, and session management. | | Command Processor | Parses MTP operation codes, validates parameters, invokes handlers. | | Object Manager | Interfaces with file system (FAT, exFAT, SPIFFS) to create/read/delete/rename objects. | | Property Provider | Maps standard MTP properties (e.g., StorageID , ObjectFormat ) to device metadata. |
While primarily for developers, users sometimes need the kit to fix driver issues or for simulation. MTP Responder Development Guide
MTP: Received CMD_GET_OBJECT_INFO (0x1005) MTP: Responding with 32-byte object info MTP: Bulk OUT transfer completed, 2048 bytes written to /sdcard/DCIM/photo.jpg
bool mtp_usb_send(const uint8_t* data, uint32_t len); bool mtp_usb_recv(uint8_t* buf, uint32_t timeout_ms); void mtp_usb_attach(void); // Notify host of device availability
Why was this shift necessary?
void mtp_send_event(uint16_t event_code, uint32_t param1);
The kit typically includes:
| RTOS Feature | Usage | |--------------|-------| | Mutex | Protect object list during concurrent host access | | Message queue | Deliver USB events to MTP task | | Semaphore | Block waiting for MTP response when acting as initiator |
For a developer, the journey with the Porting Kit typically follows a structured path: