Add lightsctl-huawei to test huawei brightness control

This commit is contained in:
Pierre-Hugues Husson 2019-06-14 00:14:28 +02:00
parent 9fcb8428ac
commit 7c94ba9902
2 changed files with 33 additions and 0 deletions

View File

@ -139,3 +139,15 @@ cc_binary {
"libprotobuf-cpp-lite"
],
}
cc_binary {
name: "lightsctl-huawei",
srcs: [
"lightsctl-huawei.cpp",
],
shared_libs: [
"vendor.huawei.hardware.light@2.0",
"libutils",
"libhidlbase",
],
}

21
cmds/lightsctl-huawei.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <iostream>
#include <vendor/huawei/hardware/light/2.0/IHwLight.h>
#include <android/hardware/light/2.0/types.h>
using ::vendor::huawei::hardware::light::V2_0::IHwLight;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IHwLight::getService();
svc->HWgetSupportedTypes([](auto types) {
for(const auto& type: types) {
std::cout << "Got type " << type << std::endl;
}
});
uint32_t a = (uint32_t)strtoll(argv[1], NULL, 10);
uint32_t b = (uint32_t)strtoll(argv[2], NULL, 10);
auto ret = svc->HWsetLightBrightness(a, b);
std::cout << "Set light brightness returned " << toString(ret) << std::endl;
}