From 877a72ffdfd79294defbde08dc778c2ac9a2c9c0 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Tue, 16 May 2023 03:52:41 +0000 Subject: [PATCH] Usb: Populate UsbDataStatus only when not populated Do not override UsbDataStatus when already populated. Compliance warnings such as missing Rp do not populate UsbDataStatus and the port partner is detected. Populate UsbDataStatus only when not populated. Bug: 279251052 Change-Id: Ibe71bdd5c521ba90c124d89bd56af90087c0df18 (cherry picked from commit 47e1400c8fef8af1aea985795d7adfe3ff16871b) (cherry picked from commit a778a7c3a82c98ec56f9e2b0c2a1dce343317b48) --- usb/usb/Usb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index d5a9ced5..e4f0b354 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -327,7 +327,8 @@ Status queryNonCompliantChargerStatus(std::vector *currentPortStatus continue; } } - if ((*currentPortStatus)[i].complianceWarnings.size() > 0) { + if ((*currentPortStatus)[i].complianceWarnings.size() > 0 && + (*currentPortStatus)[i].currentPowerRole == PortPowerRole::NONE) { (*currentPortStatus)[i].currentMode = PortMode::UFP; (*currentPortStatus)[i].currentPowerRole = PortPowerRole::SINK; (*currentPortStatus)[i].currentDataRole = PortDataRole::NONE;