summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
Diffstat (limited to 'usb')
-rw-r--r--usb/gadget/UsbGadget.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/usb/gadget/UsbGadget.cpp b/usb/gadget/UsbGadget.cpp
index 7b5b140..e83b2fc 100644
--- a/usb/gadget/UsbGadget.cpp
+++ b/usb/gadget/UsbGadget.cpp
@@ -171,7 +171,6 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
}
break;
case static_cast<uint64_t>(GadgetFunction::RNDIS):
- case GadgetFunction::RNDIS | GadgetFunction::NCM:
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = Status::CONFIGURATION_NOT_SUPPORTED;
@@ -180,7 +179,6 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
}
break;
case GadgetFunction::ADB | GadgetFunction::RNDIS:
- case GadgetFunction::ADB | GadgetFunction::RNDIS | GadgetFunction::NCM:
if (vendorFunctions == "dm") {
ret = setVidPid("0x04e8", "0x6862");
} else {
@@ -315,30 +313,20 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions,
bool ffsEnabled = false;
int i = 0;
- // Use the NCM support hack because the gadget function has no NCM definition.
- // TODO: add formal NCM function setup once gadget function supports NCM.
- uint64_t usbFunctions = functions;
- bool ncmEnabled = false;
- const std::string vendorRndisConfig = GetProperty(google::pixel::usb::kVendorRndisConfig, "");
- if ((functions & GadgetFunction::RNDIS) && (vendorRndisConfig.find("ncm.gs", 0) == 0)) {
- ncmEnabled = true;
- usbFunctions &= ~static_cast<uint64_t>(GadgetFunction::RNDIS);
- }
-
- if (addGenericAndroidFunctions(&monitorFfs, usbFunctions, &ffsEnabled, &i) !=
+ if (addGenericAndroidFunctions(&monitorFfs, functions, &ffsEnabled, &i) !=
Status::SUCCESS)
return Status::ERROR;
- if ((functions & GadgetFunction::NCM) != 0) {
+ std::string vendorFunctions = getVendorFunctions();
+
+ if (((functions & GadgetFunction::NCM) != 0) && (vendorFunctions != "dm")) {
if (linkFunction("ncm.gs9", i++))
return Status::ERROR;
}
- std::string vendorFunctions = getVendorFunctions();
-
if (vendorFunctions == "dm") {
ALOGI("enable usbradio debug functions");
- if ((usbFunctions & GadgetFunction::RNDIS) != 0) {
+ if ((functions & GadgetFunction::RNDIS) != 0) {
if (linkFunction("acm.gs6", i++))
return Status::ERROR;
if (linkFunction("dm.gs7", i++))
@@ -359,17 +347,14 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions,
return Status::ERROR;
}
- if ((usbFunctions & GadgetFunction::ADB) != 0) {
+ if ((functions & GadgetFunction::ADB) != 0) {
ffsEnabled = true;
if (addAdb(&monitorFfs, &i) != Status::SUCCESS)
return Status::ERROR;
}
- // Reordering NCM function makes Windows generic NCM driver work when vendor funcs are enabled.
- // TODO: possibly remove the reordering once vendor function Windows driver supports NCM.
- if (ncmEnabled) {
- ALOGI("set ncm function");
- if (linkFunction(vendorRndisConfig.c_str(), i++))
+ if (((functions & GadgetFunction::NCM) != 0) && (vendorFunctions == "dm")) {
+ if (linkFunction("ncm.gs9", i++))
return Status::ERROR;
}