pd: more compact PD state trace

Make the PD port state string more friendly with console limited to
64-byte wide string (eg current USB console).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=on Smaug, open the USB-console to the EC and type "pd 0 state" and
see the current type-C port state string.

Change-Id: I6903fd0f0b7371aef978f696370a6e3a200c7fa5
Reviewed-on: https://chromium-review.googlesource.com/286785
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vincent Palatin
2015-07-20 11:21:39 -07:00
committed by ChromeOS Commit Bot
parent d737517db7
commit d5afd8f968

View File

@@ -2886,15 +2886,15 @@ static int command_pd(int argc, char **argv)
} else
#endif
if (!strncasecmp(argv[2], "state", 5)) {
ccprintf("Port C%d, %s - Role: %s-%s%s Polarity: CC%d "
"Flags: 0x%04x, State: %s\n",
port, pd_comm_enabled ? "Ena" : "Dis",
ccprintf("Port C%d CC%d, %s - Role: %s-%s%s "
"State: %s, Flags: 0x%04x\n",
port, pd[port].polarity + 1,
pd_comm_enabled ? "Ena" : "Dis",
pd[port].power_role == PD_ROLE_SOURCE ? "SRC" : "SNK",
pd[port].data_role == PD_ROLE_DFP ? "DFP" : "UFP",
(pd[port].flags & PD_FLAGS_VCONN_ON) ? "-VC" : "",
pd[port].polarity + 1,
pd[port].flags,
pd_state_names[pd[port].task_state]);
pd_state_names[pd[port].task_state],
pd[port].flags);
} else {
return EC_ERROR_PARAM1;
}