summaryrefslogtreecommitdiff
path: root/usb/aidl/default/Usb.cpp
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <badhri@google.com>2021-12-27 03:42:19 -0800
committerRicky Niu <rickyniu@google.com>2022-01-24 21:28:23 +0800
commite745058f702b4ca65b9d7aa394596a285d183db2 (patch)
treecab0430b49682e7fb220197d048770ae36c27a9a /usb/aidl/default/Usb.cpp
parent6f67c56a65257844d04fb82684cf9db687f484ee (diff)
Add fields to infer UsbPortStatus and allow enabling usb while docked
Adding two fields to UsbPortStatus to infer the following: a. usbDataStatus: To infer the current USB data status of the port. b. powerBrickStatus: To infer whether a power brick is connected to the USB port. The change also adds a new method, enableUsbDataWhileDocked to allow enabling Usb port while being docked. Bug: 211677613 Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Change-Id: I4fb352679a52326bf4b0fc5aa3d218a0f34cecdb
Diffstat (limited to 'usb/aidl/default/Usb.cpp')
-rw-r--r--usb/aidl/default/Usb.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp
index 0624963883..92b09a2b44 100644
--- a/usb/aidl/default/Usb.cpp
+++ b/usb/aidl/default/Usb.cpp
@@ -74,6 +74,22 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int6
return ScopedAStatus::ok();
}
+ScopedAStatus Usb::enableUsbDataWhileDocked(const string& in_portName, int64_t in_transactionId) {
+
+ pthread_mutex_lock(&mLock);
+ if (mCallback != NULL) {
+ ScopedAStatus ret = mCallback->notifyEnableUsbDataWhileDockedStatus(
+ in_portName, Status::NOT_SUPPORTED, in_transactionId);
+ if (!ret.isOk())
+ ALOGE("notifyEnableUsbDataWhileDockedStatus error %s", ret.getDescription().c_str());
+ } else {
+ ALOGE("Not notifying the userspace. Callback is not set");
+ }
+ pthread_mutex_unlock(&mLock);
+
+ return ScopedAStatus::ok();
+}
+
Status queryMoistureDetectionStatus(std::vector<PortStatus> *currentPortStatus) {
string enabled, status, path, DetectedPath;
@@ -473,7 +489,7 @@ Status getPortStatusHelper(std::vector<PortStatus> *currentPortStatus) {
port.second ? canSwitchRoleHelper(port.first) : false;
(*currentPortStatus)[i].supportedModes.push_back(PortMode::DRP);
- (*currentPortStatus)[i].usbDataEnabled = true;
+ (*currentPortStatus)[i].usbDataStatus.push_back(UsbDataStatus::ENABLED);
ALOGI("%d:%s connected:%d canChangeMode:%d canChagedata:%d canChangePower:%d "
"usbDataEnabled:%d",