diff options
author | Ayushee <ayushee.shah@intel.com> | 2019-03-04 12:27:43 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2019-05-09 20:11:16 +0000 |
commit | 30e719e42f96f6075f7cbbd7b13a98a033c8ffbf (patch) | |
tree | d2daba9a17c553ccbef86aee69a1a3162b582662 /util | |
parent | a3bf67b7e750bd06dbb91b29a0e9b96b17e21c25 (diff) | |
download | chrome-ec-30e719e42f96f6075f7cbbd7b13a98a033c8ffbf.tar.gz |
usb_pd: Get current CC state
CC state has the information of type of device attached and it is
needed to configure the Intel virtual muxes hence returning the
current CC state in USB_PD_CONTROL host command.
BUG=None
BRANCH=None
TEST=Verified on Dragonegg, able to get correct CC state
Change-Id: I917321b599a17381e2ffbe5e813e676df03abd47
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1468049
Commit-Ready: Ayushee Shah <ayushee.shah@intel.com>
Tested-by: Ayushee Shah <ayushee.shah@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1603123
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Edward Hill <ecgh@chromium.org>
Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/util/ectool.c b/util/ectool.c index 47a3aabf2d..2ad51ffc93 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -4926,6 +4926,8 @@ int cmd_usb_pd(int argc, char *argv[]) const char *mux_str[] = {"", "none", "usb", "dp", "dock", "auto"}; const char *swap_str[] = {"", "dr_swap", "pr_swap", "vconn_swap"}; struct ec_params_usb_pd_control p; + struct ec_response_usb_pd_control_v2 *r_v2 = + (struct ec_response_usb_pd_control_v2 *)ec_inbuf; struct ec_response_usb_pd_control_v1 *r_v1 = (struct ec_response_usb_pd_control_v1 *)ec_inbuf; struct ec_response_usb_pd_control *r = @@ -4933,7 +4935,7 @@ int cmd_usb_pd(int argc, char *argv[]) int rv, i, j; int option_ok; char *e; - int cmdver = 1; + int cmdver = 2; BUILD_ASSERT(ARRAY_SIZE(role_str) == USB_PD_CTRL_ROLE_COUNT); BUILD_ASSERT(ARRAY_SIZE(mux_str) == USB_PD_CTRL_MUX_COUNT); @@ -5045,6 +5047,25 @@ int cmd_usb_pd(int argc, char *argv[]) (r_v1->role & PD_CTRL_RESP_ROLE_VCONN) ? " VCONN" : "", r_v1->polarity + 1); + if (cmdver == 2) { + printf("CC State: %d:", r_v2->cc_state); + if (r_v2->cc_state == USBC_PD_CC_NONE) + printf("None"); + else if (r_v2->cc_state == USBC_PD_CC_NO_UFP) + printf("No UFP"); + else if (r_v2->cc_state == USBC_PD_CC_AUDIO_ACC) + printf("Audio accessory"); + else if (r_v2->cc_state == USBC_PD_CC_DEBUG_ACC) + printf("Debug accessory"); + else if (r_v2->cc_state == USBC_PD_CC_UFP_ATTACHED) + printf("UFP attached"); + else if (r_v2->cc_state == USBC_PD_CC_DFP_ATTACHED) + printf("DFP attached"); + else + printf("UNKNOWN"); + printf("\n"); + } + /* If connected to a PD device, then print port partner info */ if ((r_v1->enabled & PD_CTRL_RESP_ENABLED_CONNECTED) && (r_v1->enabled & PD_CTRL_RESP_ENABLED_PD_CAPABLE)) |