From b23470dab7878f3a93475369db4c43468e960dbf Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Fri, 12 Aug 2016 17:33:39 +0200 Subject: [PATCH] pd: fix CC values in usb PD unittests The if conditions to simulate the CC line levels had a couple of typos. Use a more realistic value for those corner cases. Signed-off-by: Vincent Palatin BRANCH=none BUG=none TEST=make run-usb_pd Change-Id: Ia924ee4cfe4512a7543cfcae4d532c9a250d9c8d Reviewed-on: https://chromium-review.googlesource.com/368720 Commit-Ready: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Shawn N --- test/usb_pd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/usb_pd.c b/test/usb_pd.c index 2a8f73a684..ea68c66599 100644 --- a/test/usb_pd.c +++ b/test/usb_pd.c @@ -36,13 +36,11 @@ int pd_adc_read(int port, int cc) pd_port[port].partner_role == PD_ROLE_SOURCE) /* we are sink connected to source, return Rp/Open */ return (pd_port[port].partner_polarity == cc) ? 1700 : 0; - else if (pd_port[port].host_mode && - pd_port[port].partner_role == PD_ROLE_SINK) - /* both sources */ + else if (pd_port[port].host_mode) + /* no sink on the other side, both CC are opened */ return 3000; - else if (!pd_port[port].host_mode && - pd_port[port].partner_role == PD_ROLE_SOURCE) - /* both sinks */ + else if (!pd_port[port].host_mode) + /* no source on the other side, both CC are opened */ return 0; /* should never get here */