UsbGadget: Add support for UVC function am: b75f286a74
Original change: https://googleplex-android-review.googlesource.com/c/device/google/zuma/+/24049106 Change-Id: If46411cfc82e891fdf42c59c0829b185997abf18 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
6d14bfdb35
1 changed files with 27 additions and 0 deletions
|
@ -26,6 +26,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include <aidl/android/frameworks/stats/IStats.h>
|
||||
|
||||
namespace aidl {
|
||||
|
@ -34,6 +36,9 @@ namespace hardware {
|
|||
namespace usb {
|
||||
namespace gadget {
|
||||
|
||||
using ::android::base::GetBoolProperty;
|
||||
using ::android::hardware::google::pixel::usb::kUvcEnabled;
|
||||
|
||||
string enabledPath;
|
||||
constexpr char kHsi2cPath[] = "/sys/devices/platform/10cb0000.hsi2c";
|
||||
constexpr char kI2CPath[] = "/sys/devices/platform/10cb0000.hsi2c/i2c-";
|
||||
|
@ -302,6 +307,28 @@ static Status validateAndSetVidPid(uint64_t functions) {
|
|||
ret = Status(setVidPid("0x18d1", "0x4eec"));
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::UVC:
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else if (!GetBoolProperty(kUvcEnabled, false)) {
|
||||
ALOGE("UVC function not enabled by config");
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = Status(setVidPid("0x18d1", "0x4eed"));
|
||||
}
|
||||
break;
|
||||
case GadgetFunction::ADB | GadgetFunction::UVC:
|
||||
if (!(vendorFunctions == "user" || vendorFunctions == "")) {
|
||||
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else if (!GetBoolProperty(kUvcEnabled, false)) {
|
||||
ALOGE("UVC function not enabled by config");
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
} else {
|
||||
ret = Status(setVidPid("0x18d1", "0x4eee"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ALOGE("Combination not supported");
|
||||
ret = Status::CONFIGURATION_NOT_SUPPORTED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue