net: lwm2m: shell - allow leading slash

Paths should start from root.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
This commit is contained in:
Veijo Pesonen 2022-11-10 14:42:36 +02:00 committed by Fabio Baltieri
commit f467410088

View file

@ -24,7 +24,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#define LWM2M_HELP_CMD "LwM2M commands"
#define LWM2M_HELP_SEND "LwM2M SEND operation\nsend [OPTION]... [PATH]...\n" \
"-n\t Send as non-confirmable\n" \
"Paths are inserted without leading '/'\n" \
"Root-level operation is unsupported"
#define LWM2M_HELP_EXEC "Execute a resource\nexec PATH\n"
#define LWM2M_HELP_READ "Read value from LwM2M resource\nread PATH [OPTIONS]\n" \
@ -81,14 +80,6 @@ static int cmd_send(const struct shell *sh, size_t argc, char **argv)
return -EINVAL;
}
for (int idx = ignore_cnt; idx < argc; idx++) {
if (argv[idx][0] < '0' || argv[idx][0] > '9') {
shell_error(sh, "invalid path: %s\n", argv[idx]);
shell_help(sh);
return -EINVAL;
}
}
ret = lwm2m_engine_send(ctx, (const char **)&(argv[ignore_cnt]),
path_cnt, confirmable);
if (ret < 0) {