summaryrefslogtreecommitdiffstats
path: root/light
diff options
context:
space:
mode:
authorTreeHugger Robot2018-03-16 14:39:05 -0500
committerAndroid (Google) Code Review2018-03-16 14:39:05 -0500
commitebc5e9a5ea5e1bb6bc654ee72c38e512ba59d025 (patch)
tree51b598e7999186389d4f28ada34fedbb2b690f0c /light
parentdca679a7a96353bdb5f8ee8481d1f5d32ba7b516 (diff)
parent04f859a9b96bcd3b0deee6b84f20fcb841156e08 (diff)
downloadplatform-hardware-interfaces-ebc5e9a5ea5e1bb6bc654ee72c38e512ba59d025.tar.gz
platform-hardware-interfaces-ebc5e9a5ea5e1bb6bc654ee72c38e512ba59d025.tar.xz
platform-hardware-interfaces-ebc5e9a5ea5e1bb6bc654ee72c38e512ba59d025.zip
Merge "blank_screen: shut off all lights" into pi-dev
Diffstat (limited to 'light')
-rw-r--r--light/utils/main.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/light/utils/main.cpp b/light/utils/main.cpp
index 1f9cb9ce..d07e799a 100644
--- a/light/utils/main.cpp
+++ b/light/utils/main.cpp
@@ -26,6 +26,7 @@ void error(const std::string& msg) {
26} 26}
27 27
28int main() { 28int main() {
29 using ::android::hardware::hidl_vec;
29 using ::android::hardware::light::V2_0::Brightness; 30 using ::android::hardware::light::V2_0::Brightness;
30 using ::android::hardware::light::V2_0::Flash; 31 using ::android::hardware::light::V2_0::Flash;
31 using ::android::hardware::light::V2_0::ILight; 32 using ::android::hardware::light::V2_0::ILight;
@@ -44,9 +45,15 @@ int main() {
44 .color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER, 45 .color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER,
45 }; 46 };
46 47
47 Status ret = service->setLight(Type::BACKLIGHT, off).withDefault(Status::UNKNOWN); 48 service->getSupportedTypes([&](const hidl_vec<Type>& types) {
48 if (ret != Status::SUCCESS) { 49 for (Type type : types) {
49 error("Failed to shut off screen"); 50 Status ret = service->setLight(type, off);
50 } 51 if (ret != Status::SUCCESS) {
52 error("Failed to shut off screen for type " +
53 std::to_string(static_cast<int>(type)));
54 }
55 }
56 });
57
51 return 0; 58 return 0;
52} 59}