diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index bc662abb77..57ad53054d 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -3255,7 +3255,8 @@ static int hc_usb_pd_control(struct host_cmd_handler_args *args) args->response_size = sizeof(*r); } else { r_v1->enabled = pd_comm_enabled; - r_v1->role = pd[p->port].power_role; + r_v1->role = pd[p->port].power_role | + (pd[p->port].data_role << 1); r_v1->polarity = pd[p->port].polarity; strzcpy(r_v1->state, pd_state_names[pd[p->port].task_state], diff --git a/include/ec_commands.h b/include/ec_commands.h index 1c4efdfdcc..18e9e454f7 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2741,7 +2741,7 @@ struct ec_response_usb_pd_control { struct ec_response_usb_pd_control_v1 { uint8_t enabled; - uint8_t role; + uint8_t role; /* [0] power: 0=SNK/1=SRC [1] data: 0=UFP/1=DFP */ uint8_t polarity; char state[32]; } __packed; diff --git a/util/ectool.c b/util/ectool.c index 2062ac7888..52b9eedf31 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -3136,9 +3136,10 @@ int cmd_usb_pd(int argc, char *argv[]) r->role == PD_ROLE_SOURCE ? "SRC" : "SNK", r->polarity + 1, r->state); } else { - printf("Port C%d is %sabled, Role:%s Polarity:CC%d State:%s\n", - p.port, (r_v1->enabled) ? "en" : "dis", - r_v1->role == PD_ROLE_SOURCE ? "SRC" : "SNK", + printf("Port C%d is %s, Role:%s %s Polarity:CC%d State:%s\n", + p.port, (r_v1->enabled) ? "enabled" : "disabled", + r_v1->role & PD_ROLE_SOURCE ? "SRC" : "SNK", + r_v1->role & (PD_ROLE_DFP << 1) ? "DFP" : "UFP", r_v1->polarity + 1, r_v1->state); } return (rv < 0 ? rv : 0);