diff options
author | Jett Rink <jettrink@chromium.org> | 2020-10-02 16:12:36 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-12 23:13:50 +0000 |
commit | 298f43639565db5d72d3a5c8f672c962c0cfc91b (patch) | |
tree | d929ede6efc9e4c932ed45c3091d8f7553c1fe1e | |
parent | b63257f8641c9f3c9497ee2847ac68032dc6b707 (diff) | |
download | chrome-ec-298f43639565db5d72d3a5c8f672c962c0cfc91b.tar.gz |
zephyr: use printk instead of shell_
The shell print function is not as complete as the printk function. I
see have to add functionality for the printk version, but the shell
version does not support the specifiers we use in gettime console (e.g.
"0x%016llx -> %11.6lld" format specifier)
BRANCH=none
BUG=none
TEST=flash volteer and call gettime on console and see correct results
Signed-off-by: Jett Rink <jettrink@chromium.org>
Change-Id: Iadf9fc05708c31b70735145ed43750c308b07f39
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2446028
-rw-r--r-- | zephyr/shim/src/console.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index 17364c4870..8250ebaca0 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -16,19 +16,16 @@ int cputs(enum console_channel channel, const char *str) return cprintf(channel, "%s\n", str); } -static const struct shell *current_shell; - static void console_vprintf(enum console_channel channel, const char *format, va_list args) { - if (current_shell && channel == CC_COMMAND) { - shell_vfprintf(current_shell, SHELL_NORMAL, format, args); - return; - } - /* * TODO(jrosenth): investigate using the logging subsystem * and generating modules for the channels instead of printk + * + * TODO(b/170658516): If logging doesn't work, then we should at least + * use shell_ print functions instead of printk function as they could + * be on different uarts (they are not for Chrome OS Apps though). */ vprintk(format, args); } @@ -70,20 +67,19 @@ int zshim_run_ec_console_command(int (*handler)(int argc, char **argv), char **argv, const char *help_str, const char *argdesc) { + ARG_UNUSED(shell); + for (int i = 1; i < argc; i++) { if (!help_str && !argdesc) break; if (!strcmp(argv[i], "-h")) { if (help_str) - shell_fprintf(shell, SHELL_NORMAL, "%s\n", - help_str); + printk("%s\n", help_str); if (argdesc) - shell_fprintf(shell, SHELL_NORMAL, - "Usage: %s\n", argdesc); + printk("Usage: %s\n", argdesc); return 0; } } - current_shell = shell; return handler(argc, argv); } |