Skip to content

Commit 2794836

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 41dc893 commit 2794836

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

app/src/sm_cmux.c

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

0 commit comments

Comments
 (0)