diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2023-02-23 14:41:03 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-02 01:29:07 +0000 |
commit | 7f4392aa072e649165cf4b578342945e827cae80 (patch) | |
tree | f511e9de3f002b4308ab4cf44c8aa638b222cdc1 /test | |
parent | 23d0f9a4a378bbd88e35bf142022773f2df34ba6 (diff) | |
download | chrome-ec-7f4392aa072e649165cf4b578342945e827cae80.tar.gz |
USB-PD: Print DPM state only if debug_level >= 2
Printing DPM state names is not much useful unless you're debugging
timing issues). Normally, it's mostly either in 'waiting' or 'ready'.
This patch introduces dpm_debug_level and sets it to DEBUG_LEVEL_1 by
default. It can be configured by CONFIG_USB_PD_DEBUG_LEVEL.
This prevents the EC console from being flooded by DPM state names when
a policy engine sends an EPR keep alive message.
BUG=b:257320026
BRANCH=None
TEST=On Agah, turn on/off DPM debug messages by the pd dump command.
LOW_COVERAGE_REASON=code coverage falsely reporting no coverage for
closing braces on if conditions
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I7da0c2fb775cd0978e08464c8923757094c12ca7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4289286
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/usb_pd_console.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/usb_pd_console.c b/test/usb_pd_console.c index dc574bccf0..bc647f094e 100644 --- a/test/usb_pd_console.c +++ b/test/usb_pd_console.c @@ -19,6 +19,7 @@ /* Defined in implementation */ int command_pd(int argc, const char **argv); +static enum debug_level dpm_debug_level; static enum debug_level prl_debug_level; static enum debug_level pe_debug_level; static enum debug_level tc_debug_level; @@ -92,6 +93,11 @@ void pd_srccaps_dump(int port) pd_srccaps_dump_called = true; } +void dpm_set_debug_level(enum debug_level level) +{ + dpm_debug_level = level; +} + void prl_set_debug_level(enum debug_level level) { prl_debug_level = level; @@ -273,6 +279,7 @@ static int test_command_pd_dump(void) sprintf(test, "%d", i); argv[2] = test; TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); + TEST_ASSERT(dpm_debug_level == i); TEST_ASSERT(prl_debug_level == i); TEST_ASSERT(pe_debug_level == i); TEST_ASSERT(tc_debug_level == i); @@ -280,6 +287,7 @@ static int test_command_pd_dump(void) sprintf(test, "%d", DEBUG_LEVEL_MAX + 1); argv[2] = test; + TEST_ASSERT(dpm_debug_level == DEBUG_LEVEL_MAX); TEST_ASSERT(prl_debug_level == DEBUG_LEVEL_MAX); TEST_ASSERT(pe_debug_level == DEBUG_LEVEL_MAX); TEST_ASSERT(tc_debug_level == DEBUG_LEVEL_MAX); |