Shell management
Shell management allows passing commands to the shell subsystem over the SMP protocol.
Shell management group defines following commands:
|
Command description |
---|---|
|
Shell command line execute |
Shell command line execute
The command allows to execute command line in a similar way to typing it into a shell, but both a request and a response are transported over SMP.
Shell command line execute request
Execute command request header:
|
|
|
---|---|---|
|
|
|
CBOR data of request:
{
(str)"argv" : [
(str)<cmd>
(str,opt)<arg>
...
]
}
where:
“argv” |
array consisting of strings representing command and its arguments. |
<cmd> |
command to be executed. |
<arg> |
optional arguments to command. |
Shell command line execute response
Command line execute response header fields:
|
|
|
---|---|---|
|
|
|
CBOR data of successful response:
{
(str)"o" : (str)
(str)"ret" : (int)
}
In case of error the CBOR data takes the form:
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
{
(str)"rc" : (int)
}
where:
“o” |
command output. |
“ret” |
return code from shell command execution. |
“err” -> “group” |
|
“err” -> “rc” |
contains the index of the group-based error code. Only appears if non-zero (error condition) when using SMP version 2. |
“rc” |
|
Note
In older versions of Zephyr, “rc” was used for both the mcumgr status code
and shell command execution return code, this legacy behaviour can be
restored by enabling CONFIG_MCUMGR_GRP_SHELL_LEGACY_RC_RETURN_CODE