summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
authorJerry Zhang <zhangjerry@google.com>2018-04-23 14:34:31 -0700
committerraychi <raychi@google.com>2018-05-28 18:01:17 +0800
commit3807f30d12c0066f69c580a1dd67e7c02dad4eb9 (patch)
treec225a27cfe2b4920cce3259a1e4a29a893251021 /usb
parent1ab3712edc4d6a9d968536ae58501930364b1973 (diff)
Add audio_source combinations to usb hal
This allows android auto and accessory hid to both work, and matches functionality on other device in O. Bug: 74172000 Test: auto starts Change-Id: I786cd66bed015c5ad2a4ca668f0d0fbc9c8af507
Diffstat (limited to 'usb')
-rw-r--r--usb/UsbGadget.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp
index 232326d..1976dac 100644
--- a/usb/UsbGadget.cpp
+++ b/usb/UsbGadget.cpp
@@ -390,6 +390,27 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x2d01");
break;
+ case static_cast<uint64_t>(GadgetFunction::AUDIO_SOURCE):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d02");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d03");
+ break;
+ case GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d04");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::ACCESSORY |
+ GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d05");
+ break;
default:
ALOGE("Combination not supported");
ret = Status::CONFIGURATION_NOT_SUPPORTED;
@@ -439,6 +460,11 @@ V1_0::Status UsbGadget::setupFunctions(
if (linkFunction("accessory.gs2", i++)) return Status::ERROR;
}
+ if ((functions & GadgetFunction::AUDIO_SOURCE) != 0) {
+ ALOGI("setCurrentUsbFunctions Audio Source");
+ if (linkFunction("audio_source.gs3", i++)) return Status::ERROR;
+ }
+
if ((functions & GadgetFunction::RNDIS) != 0) {
ALOGI("setCurrentUsbFunctions rndis");
if (linkFunction("gsi.rndis", i++)) return Status::ERROR;