summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-09-23 09:34:03 +0700
committerhathach <[email protected]>2025-09-23 09:34:03 +0700
commit1ab45bc52557a85f488566ee89ef48b7332b7ef0 (patch)
treeded10b27feec78ccf9e0b0d62808ecf2726c2591
parent6fa5268a9c013c9d38fc71649400d9ecc8c2dddf (diff)
try to add logo png to mtp example
-rw-r--r--examples/device/mtp/src/mtp_fs_example.c138
-rw-r--r--examples/device/mtp/src/tinyusb_logo_png.h174
-rw-r--r--examples/device/mtp/src/tusb_config.h48
-rw-r--r--src/class/mtp/mtp.h36
-rw-r--r--src/class/mtp/mtp_device.c120
5 files changed, 380 insertions, 136 deletions
diff --git a/examples/device/mtp/src/mtp_fs_example.c b/examples/device/mtp/src/mtp_fs_example.c
index a1c45c6e4..104260373 100644
--- a/examples/device/mtp/src/mtp_fs_example.c
+++ b/examples/device/mtp/src/mtp_fs_example.c
@@ -25,6 +25,7 @@
#include "class/mtp/mtp_device_storage.h"
#include "tusb.h"
+#include "tinyusb_logo_png.h"
#define MTPD_STORAGE_DESCRIPTION "storage"
#define MTPD_VOLUME_IDENTIFIER "volume"
@@ -52,48 +53,55 @@ typedef MTP_STORAGE_INFO_STRUCT(TU_ARRAY_SIZE((uint16_t[]) STORAGE_DESCRIPTRION)
//--------------------------------------------------------------------+
// RAM FILESYSTEM
//--------------------------------------------------------------------+
-#define FS_MAX_NODES 5UL
-#define FS_MAX_NODE_BYTES 128UL
-#define FS_MAX_NODE_NAME_LEN 64UL
-#define FS_ISODATETIME_LEN 26UL
+#define FS_MAX_FILE_COUNT 5UL
+#define FS_MAX_CAPACITY_BYTES (2 * 1024UL)
+#define FS_MAX_FILENAME_LEN 16UL
+#define FS_FIXED_DATETIME "20250808T173500.0" // "YYYYMMDDTHHMMSS.s"
+
+#define README_TXT_CONTENT "TinyUSB MTP on RAM Filesystem example"
typedef struct {
- uint32_t handle;
+ // uint32_t handle;
+ char name[FS_MAX_FILENAME_LEN];
+ mtp_object_formats_t format;
uint32_t parent;
- uint32_t size;
- bool allocated;
bool association;
- char name[FS_MAX_NODE_NAME_LEN];
- char created[FS_ISODATETIME_LEN];
- char modified[FS_ISODATETIME_LEN];
- uint8_t data[FS_MAX_NODE_BYTES];
+ uint32_t size;
+ uint8_t* data;
} fs_object_info_t;
-// Sample object file
-static fs_object_info_t fs_objects[FS_MAX_NODES] = {
+// object data buffer (excluding 2 predefined files)
+uint8_t fs_buf[FS_MAX_CAPACITY_BYTES];
+uint8_t fs_buf_head = 0; // simple allocation pointer
+
+// Files system, handle is index + 1
+static fs_object_info_t fs_objects[FS_MAX_FILE_COUNT] = {
{
- .handle = 1,
+ .name = "readme.txt",
+ .format = MTP_OBJ_FORMAT_TEXT,
.parent = 0,
- .allocated = true,
.association = false,
- .name = "readme.txt",
- .created = "20240104T111134.0",
- .modified = "20241214T121110.0",
- .data = "USB MTP on RAM Filesystem example\n",
- .size = 34
+ .data = (uint8_t*) README_TXT_CONTENT,
+ .size = sizeof(README_TXT_CONTENT)
+ },
+ {
+ .name = "tinyusb.png",
+ .format = MTP_OBJ_FORMAT_PNG,
+ .parent = 0,
+ .association = false,
+ .data = logo_bin,
+ .size = logo_len,
}
};
//------------- Storage Info -------------//
-
-
storage_info_t storage_info = {
.storage_type = MTP_STORAGE_TYPE_FIXED_RAM,
.filesystem_type = MTP_FILESYSTEM_TYPE_GENERIC_HIERARCHICAL,
.access_capability = MTP_ACCESS_CAPABILITY_READ_WRITE,
- .max_capacity_in_bytes = FS_MAX_NODES * FS_MAX_NODE_BYTES,
- .free_space_in_bytes = FS_MAX_NODES * FS_MAX_NODE_BYTES,
- .free_space_in_objects = FS_MAX_NODES,
+ .max_capacity_in_bytes = sizeof(README_TXT_CONTENT) + logo_len + FS_MAX_CAPACITY_BYTES,
+ .free_space_in_bytes = 0, // calculated at runtime
+ .free_space_in_objects = 0, // calculated at runtime
.storage_description = {
.count = (TU_FIELD_SZIE(storage_info_t, storage_description)-1) / sizeof(uint16_t),
.utf16 = STORAGE_DESCRIPTRION
@@ -138,32 +146,27 @@ static fs_operation_t _fs_operation = {
//--------------------------------------------------------------------+
// Get pointer to object info from handle
-fs_object_info_t* fs_object_get_from_handle(uint32_t handle);
-
-// Get the number of allocated nodes in filesystem
-unsigned int fs_get_object_count(void);
-
-fs_object_info_t* fs_object_get_from_handle(uint32_t handle) {
- fs_object_info_t* obj;
- for (unsigned int i = 0; i < FS_MAX_NODES; i++) {
- obj = &fs_objects[i];
- if (obj->allocated && obj->handle == handle)
- return obj;
+static inline fs_object_info_t* fs_get_object(uint32_t handle) {
+ if (handle == 0 || handle > FS_MAX_FILE_COUNT) {
+ return NULL;
}
- return NULL;
+ return &fs_objects[handle-1];
}
-unsigned int fs_get_object_count(void) {
- unsigned int s = 0;
- for (unsigned int i = 0; i < FS_MAX_NODES; i++) {
- if (fs_objects[i].allocated)
- s++;
+// Get the number of allocated nodes in filesystem
+uint32_t fs_get_object_count(void) {
+ uint32_t count = 0;
+ for (unsigned int i = 0; i < FS_MAX_FILE_COUNT; i++) {
+ if (fs_objects[i].name[0] != 0) {
+ count++;
+ }
}
- return s;
+ return count;
}
int32_t tud_mtp_data_complete_cb(uint8_t idx, mtp_container_header_t* cmd_header, mtp_generic_container_t* resp_block, tusb_xfer_result_t xfer_result, uint32_t xferred_bytes) {
(void) idx;
+ (void) cmd_header;
resp_block->len = MTP_CONTAINER_HEADER_LENGTH;
resp_block->code = (xfer_result == XFER_RESULT_SUCCESS) ? MTP_RESP_OK : MTP_RESP_GENERAL_ERROR;
tud_mtp_response_send(resp_block);
@@ -225,8 +228,8 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
case MTP_OP_GET_STORAGE_INFO: {
TU_VERIFY(SUPPORTED_STORAGE_ID == cmd_block->data[0], -1);
// update storage info with current free space
- storage_info.free_space_in_objects = FS_MAX_NODES - fs_get_object_count();
- storage_info.free_space_in_bytes = storage_info.free_space_in_objects * FS_MAX_NODE_BYTES;
+ storage_info.free_space_in_objects = FS_MAX_FILE_COUNT - fs_get_object_count();
+ storage_info.free_space_in_bytes = FS_MAX_CAPACITY_BYTES-fs_buf_head;
mtp_container_add_raw(out_block, &storage_info, sizeof(storage_info));
tud_mtp_data_send(out_block);
break;
@@ -274,12 +277,13 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
return MTP_RESP_INVALID_STORAGE_ID;
}
- uint32_t handles[FS_MAX_NODES] = { 0 };
+ uint32_t handles[FS_MAX_FILE_COUNT] = { 0 };
uint32_t count = 0;
- for (uint8_t i = 0, h = 0; i < FS_MAX_NODES; i++) {
- if (fs_objects[i].allocated && parent_handle == fs_objects[i].parent ||
- (parent_handle == 0xFFFFFFFF && fs_objects[i].parent == 0)) {
- handles[count++] = fs_objects[i].handle;
+ for (uint8_t i = 0; i < FS_MAX_FILE_COUNT; i++) {
+ fs_object_info_t* obj = &fs_objects[i];
+ if (obj->name[0] != 0 &&
+ (parent_handle == obj->parent || (parent_handle == 0xFFFFFFFF && obj->parent == 0))) {
+ handles[count++] = i + 1; // handle is index + 1
}
}
mtp_container_add_auint32(out_block, count, handles);
@@ -289,22 +293,22 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
case MTP_OP_GET_OBJECT_INFO: {
const uint32_t obj_handle = cmd_block->data[0];
- fs_object_info_t* obj = fs_object_get_from_handle(obj_handle);
+ fs_object_info_t* obj = fs_get_object(obj_handle);
if (obj == NULL) {
return MTP_RESP_INVALID_OBJECT_HANDLE;
}
mtp_object_info_header_t obj_info_header = {
.storage_id = SUPPORTED_STORAGE_ID,
- .object_format = MTP_OBJ_FORMAT_TEXT,
+ .object_format = obj->format,
.protection_status = MTP_PROTECTION_STATUS_NO_PROTECTION,
.object_compressed_size = obj->size,
.thumb_format = MTP_OBJ_FORMAT_UNDEFINED,
.thumb_compressed_size = 0,
.thumb_pix_width = 0,
.thumb_pix_height = 0,
- .image_pix_width = 0,
- .image_pix_height = 0,
- .image_bit_depth = 0,
+ .image_pix_width = 128,
+ .image_pix_height = 64,
+ .image_bit_depth = 32,
.parent_object = obj->parent,
.association_type = MTP_ASSOCIATION_UNDEFINED,
.association_desc = 0,
@@ -312,8 +316,8 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
};
mtp_container_add_raw(out_block, &obj_info_header, sizeof(obj_info_header));
mtp_container_add_cstring(out_block, obj->name);
- mtp_container_add_cstring(out_block, obj->created);
- mtp_container_add_cstring(out_block, obj->modified);
+ mtp_container_add_cstring(out_block, FS_FIXED_DATETIME);
+ mtp_container_add_cstring(out_block, FS_FIXED_DATETIME);
mtp_container_add_cstring(out_block, ""); // keywords, not used
tud_mtp_data_send(out_block);
@@ -322,7 +326,7 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
case MTP_OP_GET_OBJECT: {
const uint32_t obj_handle = cmd_block->data[0];
- fs_object_info_t* obj = fs_object_get_from_handle(obj_handle);
+ fs_object_info_t* obj = fs_get_object(obj_handle);
if (obj == NULL) {
return MTP_RESP_INVALID_OBJECT_HANDLE;
}
@@ -341,6 +345,7 @@ int32_t tud_mtp_command_received_cb(uint8_t idx, mtp_generic_container_t* cmd_bl
//--------------------------------------------------------------------+
// API
//--------------------------------------------------------------------+
+#if 0
mtp_response_t tud_mtp_storage_format(uint32_t storage_id) {
if (_fs_operation.session_id == 0) {
TU_LOG1("ERR: Session not open\r\n");
@@ -383,7 +388,7 @@ mtp_response_t tud_mtp_storage_object_write_info(uint32_t storage_id, uint32_t p
// Ensure we are not creating an orphaned object outside root
if (parent_object != 0) {
- obj = fs_object_get_from_handle(parent_object);
+ obj = fs_get_object(parent_object);
if (obj == NULL) {
TU_LOG1("Parent %ld does not exist\r\n", parent_object);
return MTP_RESP_INVALID_PARENT_OBJECT;
@@ -433,7 +438,7 @@ mtp_response_t tud_mtp_storage_object_write_info(uint32_t storage_id, uint32_t p
mtp_response_t tud_mtp_storage_object_write(uint32_t object_handle, const uint8_t* buffer, uint32_t size) {
fs_object_info_t* obj;
- obj = fs_object_get_from_handle(object_handle);
+ obj = fs_get_object(object_handle);
if (obj == NULL) {
TU_LOG1("ERR: Object with handle %ld does not exist\r\n", object_handle);
return MTP_RESP_INVALID_OBJECT_HANDLE;
@@ -466,7 +471,7 @@ mtp_response_t tud_mtp_storage_object_move(uint32_t object_handle, uint32_t new_
// Ensure we are not moving to an nonexisting parent
if (new_parent_object_handle != 0) {
- obj = fs_object_get_from_handle(new_parent_object_handle);
+ obj = fs_get_object(new_parent_object_handle);
if (obj == NULL) {
TU_LOG1("Parent %ld does not exist\r\n", new_parent_object_handle);
return MTP_RESP_INVALID_PARENT_OBJECT;
@@ -477,7 +482,7 @@ mtp_response_t tud_mtp_storage_object_move(uint32_t object_handle, uint32_t new_
}
}
- obj = fs_object_get_from_handle(object_handle);
+ obj = fs_get_object(object_handle);
if (obj == NULL) {
TU_LOG1("ERR: Object with handle %ld does not exist\r\n", object_handle);
@@ -500,7 +505,7 @@ mtp_response_t tud_mtp_storage_object_delete(uint32_t object_handle) {
object_handle = 0;
if (object_handle != 0) {
- obj = fs_object_get_from_handle(object_handle);
+ obj = fs_get_object(object_handle);
if (obj == NULL) {
TU_LOG1("ERR: Object with handle %ld does not exist\r\n", object_handle);
@@ -525,6 +530,7 @@ mtp_response_t tud_mtp_storage_object_delete(uint32_t object_handle) {
void tud_mtp_storage_object_done(void) {
}
+#endif
void tud_mtp_storage_cancel(void) {
fs_object_info_t* obj;
@@ -535,9 +541,9 @@ void tud_mtp_storage_cancel(void) {
_fs_operation.read_pos = 0;
// If write operation is canceled, discard object
if (_fs_operation.write_handle) {
- obj = fs_object_get_from_handle(_fs_operation.write_handle);
- if (obj)
- obj->allocated = false;
+ obj = fs_get_object(_fs_operation.write_handle);
+ // if (obj)
+ // obj->allocated = false;
}
_fs_operation.write_handle = 0;
_fs_operation.write_pos = 0;
diff --git a/examples/device/mtp/src/tinyusb_logo_png.h b/examples/device/mtp/src/tinyusb_logo_png.h
new file mode 100644
index 000000000..d1071c6d3
--- /dev/null
+++ b/examples/device/mtp/src/tinyusb_logo_png.h
@@ -0,0 +1,174 @@
+const size_t logo_len = 2733;
+const uint8_t logo_bin[] __attribute__((aligned(16))) = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0xd2, 0xd6, 0x7f,
+ 0x7f, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,
+ 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x0a, 0x62, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0xed, 0x9c, 0x7d,
+ 0x54, 0x54, 0x65, 0x1a, 0xc0, 0x7f, 0xc3, 0x00, 0x29, 0x1f, 0x31, 0x88, 0x61, 0x90, 0xd6, 0xa1,
+ 0xb3, 0xba, 0x1a, 0x18, 0x7e, 0xf2, 0xad, 0x40, 0x82, 0xb8, 0x9b, 0x2b, 0x43, 0x1e, 0xd2, 0x00,
+ 0x53, 0xc0, 0xea, 0xec, 0xc9, 0x70, 0x18, 0x3d, 0x5b, 0xb1, 0x9e, 0x4a, 0x6d, 0x13, 0x2d, 0xcb,
+ 0x76, 0xcd, 0x00, 0xf3, 0x8b, 0x10, 0x8a, 0x8e, 0xd6, 0xee, 0xda, 0x8a, 0x96, 0x30, 0x66, 0xa2,
+ 0xa0, 0x91, 0x64, 0xae, 0x16, 0x98, 0x45, 0x9d, 0x2c, 0x93, 0x8f, 0x05, 0x11, 0x92, 0x81, 0xbb,
+ 0x7f, 0xa8, 0x93, 0x33, 0x23, 0xcc, 0xdc, 0x61, 0x60, 0x46, 0xb8, 0xb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x34, 0x3a, 0x00, 0xe2, 0x0e, 0xaa, 0x49, 0x0c, 0x24, 0xca, 0x65, 0x82,
+ 0x20, 0x44, 0x03, 0x07, 0x90, 0xe6, 0x01, 0x83, 0x0d, 0x01, 0x88, 0x75, 0x90, 0xc9, 0x64, 0x65,
+ 0xc0, 0x8b, 0xb6, 0xf6, 0x46, 0xa2, 0xdf, 0xf9, 0x9b, 0x4c, 0x26, 0x3b, 0xa0, 0x7b, 0xea, 0x05,
+ 0x41, 0x98, 0x0b, 0xa8, 0x81, 0x89, 0xc0, 0x50, 0x9b, 0xb9, 0x25, 0xd1, 0x97, 0xb4, 0x03, 0x9f,
+ 0x03, 0xeb, 0x65, 0x32, 0xd9, 0x2e, 0x80, 0xff, 0x03, 0xff, 0x08, 0x81, 0xdd, 0xa8, 0xcb, 0xf5,
+ 0x99, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
+};
diff --git a/examples/device/mtp/src/tusb_config.h b/examples/device/mtp/src/tusb_config.h
index 251a99fd3..7e2c5b670 100644
--- a/examples/device/mtp/src/tusb_config.h
+++ b/examples/device/mtp/src/tusb_config.h
@@ -92,18 +92,52 @@
//------------- CLASS -------------//
#define CFG_TUD_MTP 1
-
-#define CFG_TUD_MANUFACTURER "TinyUsb Manufacturer"
-#define CFG_TUD_MODEL "TinyUsb Device"
-
#define CFG_MTP_EP_SIZE 64
#define CFG_MTP_EVT_EP_SIZE 64
#define CFG_MTP_EVT_INTERVAL 100
-#define CFG_MTP_DEVICE_VERSION "1.0"
-#define CFG_MTP_SERIAL_NUMBER "0"
+//------------- MTP device info -------------//
+#define CFG_TUD_MTP_DEVICEINFO_EXTENSIONS "microsoft.com: 1.0; "
+#define CFG_TUD_MTP_DEVICEINFO_SUPPORTED_OPERATIONS \
+ MTP_OP_GET_DEVICE_INFO, \
+ MTP_OP_OPEN_SESSION, \
+ MTP_OP_CLOSE_SESSION, \
+ MTP_OP_GET_STORAGE_IDS, \
+ MTP_OP_GET_STORAGE_INFO, \
+ MTP_OP_GET_NUM_OBJECTS, \
+ MTP_OP_GET_OBJECT_HANDLES, \
+ MTP_OP_GET_OBJECT_INFO, \
+ MTP_OP_GET_OBJECT, \
+ MTP_OP_DELETE_OBJECT, \
+ MTP_OP_SEND_OBJECT_INFO, \
+ MTP_OP_SEND_OBJECT, \
+ MTP_OP_FORMAT_STORE, \
+ MTP_OP_RESET_DEVICE, \
+ MTP_OP_GET_DEVICE_PROP_DESC, \
+ MTP_OP_GET_DEVICE_PROP_VALUE, \
+ MTP_OP_SET_DEVICE_PROP_VALUE
+
+#define CFG_TUD_MTP_DEVICEINFO_SUPPORTED_EVENTS \
+ MTP_EVENT_OBJECT_ADDED
+
+#define CFG_TUD_MTP_DEVICEINFO_SUPPORTED_DEVICE_PROPERTIES \
+ MTP_DEV_PROP_DEVICE_FRIENDLY_NAME
+
+#define CFG_TUD_MTP_DEVICEINFO_CAPTURE_FORMATS \
+ MTP_OBJ_FORMAT_UNDEFINED, \
+ MTP_OBJ_FORMAT_ASSOCIATION, \
+ MTP_OBJ_FORMAT_TEXT, \
+ MTP_OBJ_FORMAT_PNG
+
+#define CFG_TUD_MTP_DEVICEINFO_PLAYBACK_FORMATS \
+ MTP_OBJ_FORMAT_UNDEFINED, \
+ MTP_OBJ_FORMAT_ASSOCIATION, \
+ MTP_OBJ_FORMAT_TEXT, \
+ MTP_OBJ_FORMAT_PNG
+
+#define CFG_TUD_MANUFACTURER "TinyUsb Manufacturer"
+#define CFG_TUD_MODEL "TinyUsb Device"
#define CFG_MTP_INTERFACE (CFG_TUD_MODEL " MTP")
-#define CFG_MTP_STORAGE_ID_COUNT 1
#ifdef __cplusplus
}
diff --git a/src/class/mtp/mtp.h b/src/class/mtp/mtp.h
index c844b08ab..c44b99fda 100644
--- a/src/class/mtp/mtp.h
+++ b/src/class/mtp/mtp.h
@@ -470,7 +470,7 @@ typedef enum {
MTP_OP_DELETE_OBJECT = 0x100Bu,
MTP_OP_SEND_OBJECT_INFO = 0x100Cu,
MTP_OP_SEND_OBJECT = 0x100Du,
- MTP_OP_INITIAL_CAPTURE = 0x100Eu,
+ MTP_OP_INITIATE_CAPTURE = 0x100Eu,
MTP_OP_FORMAT_STORE = 0x100Fu,
MTP_OP_RESET_DEVICE = 0x1010u,
MTP_OP_SELF_TEST = 0x1011u,
@@ -734,6 +734,10 @@ typedef struct TU_ATTR_PACKED {
uint16_t association_type;
uint32_t association_desc;
uint32_t sequence_number;
+ // mtp_string_t() filename
+ // mtp_string_t() date_created
+ // mtp_string_t() date_modified
+ // mtp_string_t() keywords
} mtp_object_info_header_t;
// Device property desc up to get/set
@@ -775,12 +779,15 @@ typedef struct TU_ATTR_PACKED {
//--------------------------------------------------------------------+
TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_raw(mtp_generic_container_t* p_container, const void* data, uint32_t len) {
+ TU_ASSERT(p_container->len + len < sizeof(mtp_generic_container_t), 0);
memcpy((uint8_t*) p_container + p_container->len, data, len);
p_container->len += len;
return len;
}
TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_array(mtp_generic_container_t* p_container, uint8_t scalar_size, uint32_t count, const void* data) {
+ const uint32_t added_len = 4 + count * scalar_size;
+ TU_ASSERT(p_container->len + added_len < sizeof(mtp_generic_container_t), 0);
uint8_t* container8 = (uint8_t*)p_container;
tu_unaligned_write32(container8 + p_container->len, count);
@@ -789,32 +796,43 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_array(mtp_generic
memcpy(container8 + p_container->len, data, count * scalar_size);
p_container->len += count * scalar_size;
- return 4 + count * scalar_size;
+ return added_len;
}
TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_string(mtp_generic_container_t* p_container, uint8_t count, uint16_t* utf16) {
+ const uint32_t added_len = 1 + 2 * count;
+ TU_ASSERT(p_container->len + added_len < sizeof(mtp_generic_container_t), 0);
uint8_t* container8 = (uint8_t*) p_container;
+
container8[p_container->len] = count;
p_container->len++;
memcpy(container8 + p_container->len, utf16, 2 * count);
p_container->len += 2 * count;
- return 1 + 2 * count;
+ return added_len;
}
TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_cstring(mtp_generic_container_t* p_container, const char* str) {
- uint8_t* container8 = (uint8_t*) p_container;
const uint8_t len = (uint8_t) (strlen(str) + 1); // include null
+ TU_ASSERT(p_container->len + 1 + 2 * len < sizeof(mtp_generic_container_t), 0);
+
+ uint8_t* container8 = (uint8_t*) p_container;
container8[p_container->len] = len;
p_container->len++;
- for (uint8_t i = 0; i < len; i++) {
- container8[p_container->len] = str[i];
- container8[p_container->len + 1] = 0;
- p_container->len += 2;
+ if (len == 1) {
+ // empty string (null only)
+ container8[p_container->len] = 0;
+ return 1;
+ } else {
+ for (uint8_t i = 0; i < len; i++) {
+ container8[p_container->len] = str[i];
+ container8[p_container->len + 1] = 0;
+ p_container->len += 2;
+ }
+ return 1 + 2 * len;
}
- return 1 + 2 * len;
}
TU_ATTR_ALWAYS_INLINE static inline uint32_t mtp_container_add_uint8(mtp_generic_container_t* p_container, uint8_t data) {
diff --git a/src/class/mtp/mtp_device.c b/src/class/mtp/mtp_device.c
index ca594158e..91df13111 100644
--- a/src/class/mtp/mtp_device.c
+++ b/src/class/mtp/mtp_device.c
@@ -103,6 +103,65 @@ CFG_TUD_MEM_SECTION CFG_TUSB_MEM_ALIGN static char _mtp_datestr[20];
//--------------------------------------------------------------------+
+// Debug
+//--------------------------------------------------------------------+
+#if CFG_TUSB_DEBUG >= CFG_TUD_MTP_LOG_LEVEL
+
+TU_ATTR_UNUSED static tu_lookup_entry_t const _mpt_op_lookup[] = {
+{.key = MTP_OP_UNDEFINED , .data = "Undefined" } ,
+{.key = MTP_OP_GET_DEVICE_INFO , .data = "GetDeviceInfo" } ,
+{.key = MTP_OP_OPEN_SESSION , .data = "OpenSession" } ,
+{.key = MTP_OP_CLOSE_SESSION , .data = "CloseSession" } ,
+{.key = MTP_OP_GET_STORAGE_IDS , .data = "GetStorageIDs" } ,
+{.key = MTP_OP_GET_STORAGE_INFO , .data = "GetStorageInfo" } ,
+{.key = MTP_OP_GET_NUM_OBJECTS , .data = "GetNumObjects" } ,
+{.key = MTP_OP_GET_OBJECT_HANDLES , .data = "GetObjectHandles" } ,
+{.key = MTP_OP_GET_OBJECT_INFO , .data = "GetObjectInfo" } ,
+{.key = MTP_OP_GET_OBJECT , .data = "GetObject" } ,
+{.key = MTP_OP_GET_THUMB , .data = "GetThumb" } ,
+{.key = MTP_OP_DELETE_OBJECT , .data = "DeleteObject" } ,
+{.key = MTP_OP_SEND_OBJECT_INFO , .data = "SendObjectInfo" } ,
+{.key = MTP_OP_SEND_OBJECT , .data = "SendObject" } ,
+{.key = MTP_OP_INITIATE_CAPTURE , .data = "InitiateCapture" } ,
+{.key = MTP_OP_FORMAT_STORE , .data = "FormatStore" } ,
+{.key = MTP_OP_RESET_DEVICE , .data = "ResetDevice" } ,
+{.key = MTP_OP_SELF_TEST , .data = "SelfTest" } ,
+{.key = MTP_OP_SET_OBJECT_PROTECTION , .data = "SetObjectProtection" } ,
+{.key = MTP_OP_POWER_DOWN , .data = "PowerDown" } ,
+{.key = MTP_OP_GET_DEVICE_PROP_DESC , .data = "GetDevicePropDesc" } ,
+{.key = MTP_OP_GET_DEVICE_PROP_VALUE , .data = "GetDevicePropValue" } ,
+{.key = MTP_OP_SET_DEVICE_PROP_VALUE , .data = "SetDevicePropValue" } ,
+{.key = MTP_OP_RESET_DEVICE_PROP_VALUE , .data = "ResetDevicePropValue" } ,
+{.key = MTP_OP_TERMINATE_OPEN_CAPTURE , .data = "TerminateOpenCapture" } ,
+{.key = MTP_OP_MOVE_OBJECT , .data = "MoveObject" } ,
+{.key = MTP_OP_COPY_OBJECT , .data = "CopyObject" } ,
+{.key = MTP_OP_GET_PARTIAL_OBJECT , .data = "GetPartialObject" } ,
+{.key = MTP_OP_INITIATE_OPEN_CAPTURE , .data = "InitiateOpenCapture" } ,
+{.key = MTP_OP_GET_OBJECT_PROPS_SUPPORTED , .data = "GetObjectPropsSupported" } ,
+{.key = MTP_OP_GET_OBJECT_PROP_DESC , .data = "GetObjectPropDesc" } ,
+{.key = MTP_OP_GET_OBJECT_PROP_VALUE , .data = "GetObjectPropValue" } ,
+{.key = MTP_OP_SET_OBJECT_PROP_VALUE , .data = "SetObjectPropValue" } ,
+{.key = MTP_OP_GET_OBJECT_PROPLIST , .data = "GetObjectPropList" } ,
+{.key = MTP_OP_GET_OBJECT_PROP_REFERENCES , .data = "GetObjectPropReferences" } ,
+{.key = MTP_OP_GET_SERVICE_IDS , .data = "GetServiceIDs" } ,
+{.key = MTP_OP_GET_SERVICE_INFO , .data = "GetServiceInfo" } ,
+{.key = MTP_OP_GET_SERVICE_CAPABILITIES , .data = "GetServiceCapabilities" } ,
+{.key = MTP_OP_GET_SERVICE_PROP_DESC , .data = "GetServicePropDesc" } ,
+{.key = MTP_OP_GET_OBJECT_PROP_LIST , .data = "GetObjectPropList" } ,
+{.key = MTP_OP_SET_OBJECT_PROP_LIST , .data = "SetObjectPropList" } ,
+{.key = MTP_OP_GET_INTERDEPENDENT_PROP_DESC , .data = "GetInterdependentPropDesc" } ,
+{.key = MTP_OP_SEND_OBJECT_PROP_LIST , .data = "SendObjectPropList" }
+};
+
+TU_ATTR_UNUSED static tu_lookup_table_t const _mtp_op_table = {
+ .count = TU_ARRAY_SIZE(_mpt_op_lookup),
+ .items = _mpt_op_lookup
+};
+
+#endif
+
+
+//--------------------------------------------------------------------+
// Helper
//--------------------------------------------------------------------+
@@ -382,11 +441,12 @@ mtp_phase_type_t mtpd_handle_cmd(mtpd_interface_t* p_mtp) {
_mtpd_soi.object_handle = 0;
}
- mtp_phase_type_t ret = MTP_PHASE_RESPONSE;
+ tu_lookup_find(&_mtp_op_table, cmd_block.code);
+ TU_LOG_DRV(" MTP command: %s\r\n", (char const*) tu_lookup_find(&_mtp_op_table, cmd_block.code));
- switch (p_container->code) {
+ mtp_phase_type_t ret = MTP_PHASE_RESPONSE;
+ switch (cmd_block.code) {
case MTP_OP_GET_DEVICE_INFO: {
- TU_LOG_DRV(" MTP command: MTP_OP_GET_DEVICE_INFO\n");
tud_mtp_device_info_t dev_info = {
.standard_version = 100,
.mtp_vendor_extension_id = 6, // MTP specs say 0xFFFFFFFF but libMTP check for value 6
@@ -435,63 +495,14 @@ mtp_phase_type_t mtpd_handle_cmd(mtpd_interface_t* p_mtp) {
break;
}
- case MTP_OP_OPEN_SESSION:
- TU_LOG_DRV(" MTP command: MTP_OP_OPEN_SESSION\n");
- break;
-
- case MTP_OP_CLOSE_SESSION:
- TU_LOG_DRV(" MTP command: MTP_OP_CLOSE_SESSION\n");
- break;
-
- case MTP_OP_GET_STORAGE_IDS:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_STORAGE_IDS\n");
- break;
-
- case MTP_OP_GET_STORAGE_INFO:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_STORAGE_INFO for ID=%lu\n", p_container->data[0]);
- break;
-
- case MTP_OP_GET_OBJECT_HANDLES:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_OBJECT_HANDLES\n");
- break;
-
- case MTP_OP_GET_OBJECT_INFO:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_OBJECT_INFO\n");
- break;
-
- case MTP_OP_GET_OBJECT:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_OBJECT\n");
- break;
-
- case MTP_OP_DELETE_OBJECT:
- TU_LOG_DRV(" MTP command: MTP_OP_DELETE_OBJECT\n");
- return mtpd_handle_cmd_delete_object();
-
- case MTP_OP_GET_DEVICE_PROP_DESC:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_DEVICE_PROP_DESC\n");
- break;
-
- case MTP_OP_GET_DEVICE_PROP_VALUE:
- TU_LOG_DRV(" MTP command: MTP_OP_GET_DEVICE_PROP_VALUE\n");
- break;
-
- case MTP_OP_SEND_OBJECT_INFO:
- TU_LOG_DRV(" MTP command: MTP_OP_SEND_OBJECT_INFO\n");
- return mtpd_handle_cmd_send_object_info();
- case MTP_OP_SEND_OBJECT:
- TU_LOG_DRV(" MTP command: MTP_OP_SEND_OBJECT\n");
- return mtpd_handle_cmd_send_object();
- case MTP_OP_FORMAT_STORE:
- TU_LOG_DRV(" MTP command: MTP_OP_FORMAT_STORE\n");
- return mtpd_handle_cmd_format_store();
default:
- TU_LOG_DRV(" MTP command: MTP_OP_UNKNOWN_COMMAND %x!!!!\n", p_container->code);
- return false;
+ break;
}
tud_mtp_command_received_cb(0, &cmd_block, p_container);
return ret;
}
+#if 0
mtp_phase_type_t mtpd_handle_data(void)
{
@@ -614,6 +625,7 @@ mtp_phase_type_t mtpd_handle_cmd_format_store(void)
p_container->len = MTP_CONTAINER_HEADER_LENGTH;
return MTP_PHASE_RESPONSE;
}
+#endif
//--------------------------------------------------------------------+
// Checker