summaryrefslogtreecommitdiff
path: root/usb/aidl/default/Usb.cpp
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <badhri@google.com>2021-11-25 09:35:21 -0800
committerRicky Niu <rickyniu@google.com>2022-01-21 18:49:39 +0800
commit623f13385f0e839c2c1d41e61f149a61f2e10e31 (patch)
treeb1c10844f6bc91bd8cfe56397a0efdaf3944b9fe /usb/aidl/default/Usb.cpp
parentaef9dec7dd394016caf42cd0287430f94b5d31ed (diff)
Add limitPowerTransfer API to IUsb
limitPowerTransfer is invoked to limit power transfer in and out of the Usb port. Bug: 199357330 Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Change-Id: I5f4991d024ad827ae8148fc143a44cc05bafdcb4
Diffstat (limited to 'usb/aidl/default/Usb.cpp')
-rw-r--r--usb/aidl/default/Usb.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp
index 1105376ad9..0624963883 100644
--- a/usb/aidl/default/Usb.cpp
+++ b/usb/aidl/default/Usb.cpp
@@ -289,6 +289,24 @@ ScopedAStatus Usb::switchRole(const string& in_portName,
return ScopedAStatus::ok();
}
+ScopedAStatus Usb::limitPowerTransfer(const string& in_portName, bool /*in_limit*/,
+ int64_t in_transactionId) {
+ std::vector<PortStatus> currentPortStatus;
+
+ pthread_mutex_lock(&mLock);
+ if (mCallback != NULL && in_transactionId >= 0) {
+ ScopedAStatus ret = mCallback->notifyLimitPowerTransferStatus(
+ in_portName, false, Status::NOT_SUPPORTED, in_transactionId);
+ if (!ret.isOk())
+ ALOGE("limitPowerTransfer error %s", ret.getDescription().c_str());
+ } else {
+ ALOGE("Not notifying the userspace. Callback is not set");
+ }
+ pthread_mutex_unlock(&mLock);
+
+ return ScopedAStatus::ok();
+}
+
Status getAccessoryConnected(const string &portName, string *accessory) {
string filename = kTypecPath + portName + "-partner/accessory_mode";