From d5afd8f96837ec4f78a76d1c81b35e1a9f85111d Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Mon, 20 Jul 2015 11:21:39 -0700 Subject: [PATCH] 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 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 Trybot-Ready: Vincent Palatin Tested-by: Vincent Palatin Commit-Queue: Vincent Palatin --- common/usb_pd_protocol.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index cbbe3bdefc..24f8b63e86 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -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; }