diff options
author | Jun Lin <CHLin56@nuvoton.com> | 2022-06-15 15:26:03 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-16 08:52:02 +0000 |
commit | a8c636c1648982c0597564e7ad020fb929841e96 (patch) | |
tree | bbecf184356903003a2c8121d81c9417bbdd72bf /zephyr/shim | |
parent | 11e7a02c074341b22fa149581e9251686e79bb79 (diff) | |
download | chrome-ec-a8c636c1648982c0597564e7ad020fb929841e96.tar.gz |
zephyr: console: redirect messages to printk when shell is inactive
The log messages printed in the main thread (e.x. the system banner)
cannot be shown in the UART console. Instead, The warning message
"WARNING: A print request was detected on not active shell backend." is
printed. This CL redirects the log message to printk if the shell thread
is inactive.
BRANCH=none
BUG=b:235896474
TEST=Check the system banner and other log messages in the main thread
can be printed.
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Change-Id: I42365b32d5131a80bd56c27c61e6a9aa360b250d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3706487
Reviewed-by: Andrew McRae <amcrae@google.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
Diffstat (limited to 'zephyr/shim')
-rw-r--r-- | zephyr/shim/src/console.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index 1093a26dff..f8051d8638 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -344,7 +344,8 @@ static void zephyr_print(const char *buff, size_t size) * Also, console_buf_notify_chars uses a mutex, which may not be * locked in ISRs. */ - if (k_is_in_isr() || shell_stopped) { + if (k_is_in_isr() || shell_stopped || + shell_zephyr->ctx->state != SHELL_STATE_ACTIVE) { printk("%s", buff); } else { shell_fprintf(shell_zephyr, SHELL_NORMAL, "%s", buff); |