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:
Nick Ward 2021-05-15 09:29:07 +10:00 committed by Kumar Gala
commit 3cad7f3a19
2 changed files with 18 additions and 0 deletions

View file

@ -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;
}