From c2eb14b9d1d3cec317354faeabb83572d29e379e Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 5 Feb 2015 16:41:08 -0800 Subject: pd: Mark VBUS as present when power swapping from source to sink If we power swap from a source to a sink and begin charging, VBUS will never be marked as present, which has bad side-effects when VBUS disappears and we wish to stop charging. BUG=chrome-os-partner:36389 TEST=Manual on Samus. Connect Samus-to-Samus and initiate charge override on the port. Verify that charging from the port begins. Unplug the cable and verify that the in-OS charge icon disappears. Repeat 10x. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh Change-Id: I83206c341c0d74991ad60eef411d71d30b5c67a5 Reviewed-on: https://chromium-review.googlesource.com/246781 Reviewed-by: Alec Berg --- common/usb_pd_protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 8d168e1f1c..049e53f13f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1123,6 +1123,7 @@ static void handle_ctrl_request(int port, uint16_t head, /* reset message ID and swap roles */ pd[port].msg_id = 0; pd[port].power_role = PD_ROLE_SINK; + pd[port].flags |= PD_FLAGS_VBUS_PRESENT; set_state(port, PD_STATE_SNK_DISCOVERY); } else if (pd[port].task_state == PD_STATE_SNK_DISCOVERY) { /* Don't know what power source is ready. Reset. */ -- cgit v1.2.1