From 493898bd6a9771f8b4bb588b7e59dbf9aa457228 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Wed, 5 Nov 2014 09:03:21 -0800 Subject: pd: add reject of data swap and vconn swap ctrl messages Reject data and vconn swap control messages. BUG=none BRANCH=samus TEST=test with third party device that sends data and vconn swaps and make sure we send reject Change-Id: I6261e000f24ad8c886760601a8ad7da4502f82b7 Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/227584 Reviewed-by: Vincent Palatin Reviewed-by: Todd Broch --- common/usb_pd_protocol.c | 5 ++++- include/usb_pd.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 01a997366c..e5686c0d73 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -908,7 +908,10 @@ static void handle_ctrl_request(int port, uint16_t head, send_control(port, PD_CTRL_REJECT); #endif break; - case PD_CTRL_PROTOCOL_ERR: + case PD_CTRL_DR_SWAP: + case PD_CTRL_VCONN_SWAP: + send_control(port, PD_CTRL_REJECT); + break; case PD_CTRL_WAIT: #ifdef CONFIG_USB_PD_DUAL_ROLE if (pd[port].task_state == PD_STATE_SRC_SWAP_INIT) diff --git a/include/usb_pd.h b/include/usb_pd.h index bd19600282..1f6a4e97cb 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -560,9 +560,9 @@ enum pd_ctrl_msg_type { PD_CTRL_PS_RDY = 6, PD_CTRL_GET_SOURCE_CAP = 7, PD_CTRL_GET_SINK_CAP = 8, - PD_CTRL_PROTOCOL_ERR = 9, + PD_CTRL_DR_SWAP = 9, PD_CTRL_PR_SWAP = 10, - /* 11 Reserved */ + PD_CTRL_VCONN_SWAP = 11, PD_CTRL_WAIT = 12, PD_CTRL_SOFT_RESET = 13, /* 14-15 Reserved */ -- cgit v1.2.1