Skip to content

Commit 7bb88dd

Browse files
committed
app: Add command to start CMUX traces on any CMUX channel
Add AT#XCMUXTRACE command to start CMUX modem traces on a specified channel. This is required when using AT+CMUX which does not do hard coded channel assignments. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
1 parent c537377 commit 7bb88dd

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

app/src/sm_cmux.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,44 @@ static int handle_at_cmux(enum at_parser_cmd_type cmd_type, struct at_parser *pa
402402
return -EINVAL;
403403
}
404404
}
405+
406+
#if CONFIG_SM_MODEM_TRACE_BACKEND_CMUX
407+
408+
SM_AT_CMD_CUSTOM(xcmuxtrace, "AT#XCMUXTRACE", handle_at_xcmuxtrace);
409+
static int handle_at_xcmuxtrace(enum at_parser_cmd_type cmd_type, struct at_parser *parser,
410+
uint32_t param_count)
411+
{
412+
struct modem_pipe *pipe;
413+
414+
if (cmd_type == AT_PARSER_CMD_TYPE_TEST) {
415+
rsp_send("\r\n#XCMUXTRACE: (1 ... %d)\r\n", CONFIG_SM_CMUX_CHANNEL_COUNT);
416+
return 0;
417+
}
418+
if (cmd_type != AT_PARSER_CMD_TYPE_SET || param_count > 2) {
419+
return -EINVAL;
420+
}
421+
422+
if (param_count == 2) {
423+
int ch;
424+
int ret = at_parser_num_get(parser, 1, &ch);
425+
426+
if (ret || (ch < 2 || ch >= CONFIG_SM_CMUX_CHANNEL_COUNT)) {
427+
return -EINVAL;
428+
}
429+
pipe = sm_cmux_get_dlci(ch);
430+
} else {
431+
pipe = sm_at_host_get_current_pipe();
432+
}
433+
434+
if (!pipe) {
435+
return -ENODEV;
436+
}
437+
rsp_send_ok();
438+
sm_trace_backend_detach();
439+
sm_at_host_release(sm_at_host_get_ctx_from(pipe));
440+
sm_trace_backend_attach(pipe);
441+
442+
return -SILENT_AT_COMMAND_RET;
443+
}
444+
445+
#endif

0 commit comments

Comments
 (0)