diff options
author | Boris Mittelberg <bmbm@google.com> | 2021-06-02 06:04:59 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-03 18:40:56 +0000 |
commit | 00ab08d7746028008bbc261777a1ae818cf9668e (patch) | |
tree | 543edfec1cb6812943403cd5456692a262837ab7 /common/usbc | |
parent | e407e3be482effdf4788c3bc8be9b1cee52bd1f1 (diff) | |
download | chrome-ec-00ab08d7746028008bbc261777a1ae818cf9668e.tar.gz |
PD console: add cflush around long console prints
`pd state` and `pd dualrole` command outputs are non-atomic and even
have function calls in the middle of lines. This caused the output to
be mixed with non-related prints, and FAFT is sometimes failing to
parse the needed lines. Wrapping those commands with `cflush` reduces
output corruption.
BRANCH=none
BUG=b:188881690
TEST=running FAFT PD
Signed-off-by: Boris Mittelberg <bmbm@google.com>
Change-Id: I0750df0b1ce0bb52b96718769626ca8e2e1b55c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2932456
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r-- | common/usbc/usb_pd_console.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usbc/usb_pd_console.c b/common/usbc/usb_pd_console.c index 5153be387e..bbee776611 100644 --- a/common/usbc/usb_pd_console.c +++ b/common/usbc/usb_pd_console.c @@ -114,6 +114,7 @@ test_export_static int command_pd(int argc, char **argv) return EC_ERROR_PARAM3; } else if (!strcasecmp(argv[2], "dualrole")) { if (argc < 4) { + cflush(); ccprintf("dual-role toggling: "); switch (pd_get_dual_role(port)) { case PD_DRP_TOGGLE_ON: @@ -131,6 +132,7 @@ test_export_static int command_pd(int argc, char **argv) case PD_DRP_FORCE_SOURCE: ccprintf("force source\n"); break; + cflush(); } } else { if (!strcasecmp(argv[3], "on")) @@ -155,6 +157,7 @@ test_export_static int command_pd(int argc, char **argv) } if (!strcasecmp(argv[2], "state")) { + cflush(); ccprintf("Port C%d CC%d, %s - Role: %s-%s", port, pd_get_polarity(port) + 1, pd_comm_is_enabled(port) ? "Enable" : "Disable", @@ -175,6 +178,8 @@ test_export_static int command_pd(int argc, char **argv) pe_get_flags(port)); else ccprintf("\n"); + + cflush(); } else if (!strcasecmp(argv[2], "srccaps")) { pd_srccaps_dump(port); } |