Skip to content

Commit 4970eba

Browse files
committed
debug msg
1 parent fd38aaa commit 4970eba

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

samples/subsys/usb/mtp/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ CONFIG_FILE_SYSTEM=y
1818
CONFIG_FILE_SYSTEM_LITTLEFS=y
1919

2020
CONFIG_USBD_THREAD_STACK_SIZE=4096
21+
22+
CONFIG_USBD_LOG_LEVEL_DBG=y
23+
CONFIG_USBD_MTP_LOG_LEVEL_DBG=y
24+
CONFIG_LOG_BUFFER_SIZE=8192

subsys/usb/device_next/class/usbd_mtp_class.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,22 @@ int mtp_commands_handler(struct mtp_context *ctx, struct net_buf *buf_in, struct
12591259
return buf_resp->len;
12601260
}
12611261

1262+
if (buf_in == NULL) {
1263+
LOG_ERR("%s: NULL Buffer", __func__);
1264+
LOG_ERR("session_opened: %d", ctx->session_opened);
1265+
LOG_ERR("transaction_id: %u", ctx->transaction_id);
1266+
LOG_ERR("max_packet_size: %u", ctx->max_packet_size);
1267+
LOG_ERR("transfer_state.file: %p", &ctx->transfer_state.file);
1268+
LOG_ERR("transfer_state.filepath: %s", ctx->transfer_state.filepath);
1269+
LOG_ERR("transfer_state.total_size: %u", ctx->transfer_state.total_size);
1270+
LOG_ERR("transfer_state.transferred: %u", ctx->transfer_state.transferred);
1271+
LOG_ERR("transfer_state.chunks_sent: %u", ctx->transfer_state.chunks_sent);
1272+
LOG_ERR("transfer_state.storage_id: %u", ctx->transfer_state.storage_id);
1273+
LOG_ERR("op_state.phase: %d", ctx->op_state.phase);
1274+
LOG_ERR("op_state.code: %d", ctx->op_state.code);
1275+
__ASSERT(false, "mtp_commands_handler: NULL Buffer");
1276+
}
1277+
12621278
ctx->op_state.code = mtp_command->hdr.code;
12631279
LOG_DBG(GREEN "[%s]" RESET, mtp_code_to_string(mtp_command->hdr.code));
12641280

0 commit comments

Comments
 (0)