diff options
author | Sam Hurst <shurst@google.com> | 2020-04-22 15:12:15 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-29 21:50:30 +0000 |
commit | 9abfcc7ced52511ce1c6d501a4b54014fa21f19e (patch) | |
tree | 8b6c22b99468456c812253bb95eb7a7777975fd6 /common/usbc/usb_pd_console.c | |
parent | 459021082eb95870af2ad49ac58b5c479895c8dd (diff) | |
download | chrome-ec-9abfcc7ced52511ce1c6d501a4b54014fa21f19e.tar.gz |
TCPMv2: Add dump pd command needed by PD_FAFT
Add dump pd command that sets the debug level
of the Policy Engine Layer and Protocol layer.
BUG=b:151481791
BRANCH=none
TEST=make -j buildall
manual: pd dump 0 - verified PRL layer didn't print packet info
and PE layer didn't print state names
pd dump 1 - verified PRL layer printed packet info
and PE layer printed state names
Change-Id: I49430573278a4c51f52698c1528ace2c639cc30f
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2162190
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'common/usbc/usb_pd_console.c')
-rw-r--r-- | common/usbc/usb_pd_console.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/common/usbc/usb_pd_console.c b/common/usbc/usb_pd_console.c index ba2b6efeb9..053374d874 100644 --- a/common/usbc/usb_pd_console.c +++ b/common/usbc/usb_pd_console.c @@ -7,6 +7,7 @@ #include "console.h" #include "usb_common.h" #include "usb_pe_sm.h" +#include "usb_prl_sm.h" #include "usb_tc_sm.h" #include "usb_pd.h" #include "util.h" @@ -18,7 +19,25 @@ test_export_static int command_pd(int argc, char **argv) if (argc < 2) return EC_ERROR_PARAM_COUNT; - else if (IS_ENABLED(CONFIG_USB_PD_TRY_SRC) && + + if (!strcasecmp(argv[1], "dump")) { + if (argc >= 3) { + int level = strtoi(argv[2], &e, 10); + + if (*e) + return EC_ERROR_PARAM2; + + if (level < DEBUG_DISABLE) + level = DEBUG_DISABLE; + else if (level > DEBUG_LEVEL_MAX) + level = DEBUG_LEVEL_MAX; + + prl_set_debug_level(level); + pe_set_debug_level(level); + ccprintf("debug=%d\n", level); + return EC_SUCCESS; + } + } else if (IS_ENABLED(CONFIG_USB_PD_TRY_SRC) && !strcasecmp(argv[1], "trysrc")) { enum try_src_override_t ov = tc_get_try_src_override(); @@ -149,8 +168,9 @@ test_export_static int command_pd(int argc, char **argv) return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(pd, command_pd, + "dump [0|1|2|3]" #ifdef CONFIG_USB_PD_TRY_SRC - "trysrc [0|1|2]" + "\ntrysrc [0|1|2]" #endif "\n\t<port> state" #ifdef CONFIG_USB_PD_DUAL_ROLE |