mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-01-29 02:44:24 +00:00
Do not enable the funcion when it is not in list
rndis and rmnet cannot co-exist in QCOM spec and cause ramdump. Besides, enabling functions with the wrong PID may cause it cannot install proper PC driver on Windows. A better way is to not allow enabling the function which is not in support list. Bug: 130733202 Test: enable tethering with/without rmnet enabled Signed-off-by: raychi <raychi@google.com> (cherry picked from commit 79ef1d2d35f3e00ce8ab98ff4a3430af579a5419 and fix merge conflict) Change-Id: Ia50058f498c5b99ff58251fd7064963ccdbdd940
This commit is contained in:
@@ -311,18 +311,24 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
|
||||
if (vendorFunctions == "diag") {
|
||||
ret = setVidPid("0x05C6", "0x901B");
|
||||
} else {
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee1");
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee1");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::ADB | GadgetFunction::MTP:
|
||||
if (vendorFunctions == "diag") {
|
||||
ret = setVidPid("0x05C6", "0x903A");
|
||||
} else {
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee2");
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee2");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case static_cast<uint64_t>(GadgetFunction::RNDIS):
|
||||
@@ -331,9 +337,12 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
|
||||
} else if (vendorFunctions == "serial_cdev,diag") {
|
||||
ret = setVidPid("0x05C6", "0x90B5");
|
||||
} else {
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee3");
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee3");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::ADB | GadgetFunction::RNDIS:
|
||||
@@ -342,21 +351,30 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
|
||||
} else if (vendorFunctions == "serial_cdev,diag") {
|
||||
ret = setVidPid("0x05C6", "0x90B6");
|
||||
} else {
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee4");
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee4");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case static_cast<uint64_t>(GadgetFunction::PTP):
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee5");
|
||||
break;
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee5");
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::ADB | GadgetFunction::PTP:
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee6");
|
||||
break;
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee6");
|
||||
}
|
||||
break;
|
||||
case static_cast<uint64_t>(GadgetFunction::ADB):
|
||||
if (vendorFunctions == "diag") {
|
||||
ret = setVidPid("0x05C6", "0x901D");
|
||||
@@ -365,21 +383,30 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) {
|
||||
} else if (vendorFunctions == "diag,serial_cdev") {
|
||||
ret = setVidPid("0x05C6", "0x901F");
|
||||
} else {
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee7");
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee7");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case static_cast<uint64_t>(GadgetFunction::MIDI):
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee8");
|
||||
break;
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee8");
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::ADB | GadgetFunction::MIDI:
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = setVidPid("0x18d1", "0x4ee9");
|
||||
break;
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = setVidPid("0x18d1", "0x4ee9");
|
||||
}
|
||||
break;
|
||||
case static_cast<uint64_t>(GadgetFunction::ACCESSORY):
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == ""))
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
|
||||
Reference in New Issue
Block a user