diff options
| author | hathach <[email protected]> | 2025-09-25 18:58:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-09-25 18:58:25 +0700 |
| commit | 34be38db190c9fb8ca5f6c1db8bab33566e397cb (patch) | |
| tree | eaf9a5f5d1b0441152c29b2478f530c60db96ceb /examples | |
| parent | 879f02f69c700d18ce89ec15eee7ab3ee83be92c (diff) | |
clean up, wrap up bulk command supported
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/mtp/src/mtp_fs_example.c | 90 | ||||
| -rw-r--r-- | examples/device/mtp/src/tusb_config.h | 2 |
2 files changed, 0 insertions, 92 deletions
diff --git a/examples/device/mtp/src/mtp_fs_example.c b/examples/device/mtp/src/mtp_fs_example.c index 4ccc122c7..a06fcb8db 100644 --- a/examples/device/mtp/src/mtp_fs_example.c +++ b/examples/device/mtp/src/mtp_fs_example.c @@ -513,96 +513,6 @@ int32_t tud_mtp_response_complete_cb(tud_mtp_cb_data_t* cb_data) { return 0; // nothing to do } -//--------------------------------------------------------------------+ -// 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"); - return MTP_RESP_SESSION_NOT_OPEN; - } - if (storage_id != SUPPORTED_STORAGE_ID) { - TU_LOG1("ERR: Unexpected storage id %ld\r\n", storage_id); - return MTP_RESP_INVALID_STORAGE_ID; - } - - // Simply deallocate all entries - for (unsigned int i = 0; i < FS_MAX_NODES; i++) - fs_objects[i].allocated = false; - TU_LOG1("Format completed\r\n"); - return MTP_RESP_OK; -} - -mtp_response_t tud_mtp_storage_object_move(uint32_t object_handle, uint32_t new_parent_object_handle) { - fs_file_t* obj; - - if (new_parent_object_handle == 0xFFFFFFFF) - new_parent_object_handle = 0; - - // Ensure we are not moving to an nonexisting parent - if (new_parent_object_handle != 0) { - obj = fs_get_file(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; - } - if (!obj->association_type) { - TU_LOG1("Parent %ld is not an association\r\n", new_parent_object_handle); - return MTP_RESP_INVALID_PARENT_OBJECT; - } - } - - obj = fs_get_file(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; - } - TU_LOG1("Move object %ld to new parent %ld\r\n", object_handle, new_parent_object_handle); - obj->parent = new_parent_object_handle; - return MTP_RESP_OK; -} - -mtp_response_t tud_mtp_storage_object_delete(uint32_t object_handle) { - fs_file_t* obj; - - if (_fs_operation.session_id == 0) { - TU_LOG1("ERR: Session not open\r\n"); - return MTP_RESP_SESSION_NOT_OPEN; - } - - if (object_handle == 0xFFFFFFFF) - object_handle = 0; - - if (object_handle != 0) { - obj = fs_get_file(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; - } - obj->allocated = false; - TU_LOG1("Delete object with handle %ld\r\n", object_handle); - } - - if (object_handle == 0 || obj->association_type) { - // Delete also children - for (unsigned int i = 0; i < FS_MAX_NODES; i++) { - obj = &fs_objects[i]; - if (obj->allocated && obj->parent == object_handle) { - tud_mtp_storage_object_delete(obj->handle); - } - } - } - - return MTP_RESP_OK; -} - -void tud_mtp_storage_object_done(void) { -} -#endif - void tud_mtp_storage_cancel(void) { } diff --git a/examples/device/mtp/src/tusb_config.h b/examples/device/mtp/src/tusb_config.h index 7db5235d0..62a5729bf 100644 --- a/examples/device/mtp/src/tusb_config.h +++ b/examples/device/mtp/src/tusb_config.h @@ -102,14 +102,12 @@ 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, \ |
