telnet shell: Shell does not start with specified root command #74479
-
Hi, When I connect via UART everything works fine. Shell starts with the specified command. Is this a bug or am I getting something wrong? Many thanks for your help on this issue and for the project itself - it's enjoyable to work with zephyr!
My whole *.conf file:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, me again... I answered the question myself. After going through the code I discovered that changing the root command during runtime affects all shell instances.
-->
As we can see a FOREACH is used and that's why it affects all the shells. Best regards |
Beta Was this translation helpful? Give feedback.
-
Does anyone see an option to change the root command of only one shell? |
Beta Was this translation helpful? Give feedback.
Me again,
For anyone who is interested how I solved my issue:
When a shell command is defined the
SHELL_CMD_REGISTER
expands to
static const struct shell_static_entry _shell_authentication = [...]
The interesting part is that this command declares a
static const struct shell_static_entry
named
_shell_authentication
.This can be used to set the root command in a callback of a shell command via
shell->ctx->selected_cmd = &_shell_authentication;
This sets the root command to _shell_authentication only for the shell represented by
shell
.shell_set_root_cmd
sets the root command for ALL shells.Now everything works fine and no matter which shell is used a login is needed.
Best regards.