shell: kernel: fix reset command echo abrupt termination
Allow time for the shell to successfully echo the reboot command input before the reboot abruptly terminates it. n This can help external systems that interact with the shell and require the reboot command's echo to successfully complete to synchronise with the device. Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/35325 Signed-off-by: Nick Ward <nick.ward@setec.com.au>
This commit is contained in:
parent
8039ab4887
commit
3cad7f3a19
2 changed files with 18 additions and 0 deletions
|
@ -14,6 +14,18 @@ config KERNEL_SHELL
|
|||
This shell provides access to basic kernel data like version, uptime
|
||||
and other useful information.
|
||||
|
||||
config KERNEL_SHELL_REBOOT_DELAY
|
||||
int "Delay between reception of shell reboot command and reboot (ms)"
|
||||
depends on KERNEL_SHELL
|
||||
depends on REBOOT
|
||||
default 0
|
||||
help
|
||||
This delay allows time for the shell to successfully echo the reboot
|
||||
command input before the reboot abruptly terminates it. This can help
|
||||
external systems that interact with the shell and require the reboot
|
||||
command's echo to successfully complete to synchronise with the
|
||||
device.
|
||||
|
||||
config DEVICE_SHELL
|
||||
bool "Enable device shell"
|
||||
default y if !SHELL_MINIMAL
|
||||
|
|
|
@ -220,6 +220,9 @@ static int cmd_kernel_reboot_warm(const struct shell *shell,
|
|||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
#if (CONFIG_KERNEL_SHELL_REBOOT_DELAY > 0)
|
||||
k_sleep(K_MSEC(CONFIG_KERNEL_SHELL_REBOOT_DELAY));
|
||||
#endif
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
return 0;
|
||||
}
|
||||
|
@ -229,6 +232,9 @@ static int cmd_kernel_reboot_cold(const struct shell *shell,
|
|||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
#if (CONFIG_KERNEL_SHELL_REBOOT_DELAY > 0)
|
||||
k_sleep(K_MSEC(CONFIG_KERNEL_SHELL_REBOOT_DELAY));
|
||||
#endif
|
||||
sys_reboot(SYS_REBOOT_COLD);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue