From 82b37d6e0bc12bd7218d2986df061320069f962a Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Mon, 12 Sep 2022 13:36:48 +0000 Subject: Add support for detecting Keyboard backlight using sysfs node Add new light type for Keyboard backlight and corresponding detection logic. Also, refactor PeripheralController logic to support Light type and light capabilities similar to how it is handled on Java side of code. Test: atest inputflinger_tests Bug: 245506418 Change-Id: Ic69e42555bf57a66683fcf359169869ee2a00749 --- include/input/InputDevice.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include/input/InputDevice.h') diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index 415080d15d..0026e82caa 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include #include @@ -105,12 +106,18 @@ enum class InputDeviceSensorReportingMode : int32_t { }; enum class InputDeviceLightType : int32_t { - MONO = 0, + INPUT = 0, PLAYER_ID = 1, - RGB = 2, - MULTI_COLOR = 3, + KEYBOARD_BACKLIGHT = 2, - ftl_last = MULTI_COLOR + ftl_last = KEYBOARD_BACKLIGHT +}; + +enum class InputDeviceLightCapability : uint32_t { + /** Capability to change brightness of the light */ + BRIGHTNESS = 0x00000001, + /** Capability to change color of the light */ + RGB = 0x00000002, }; struct InputDeviceSensorInfo { @@ -171,14 +178,17 @@ struct InputDeviceSensorInfo { struct InputDeviceLightInfo { explicit InputDeviceLightInfo(std::string name, int32_t id, InputDeviceLightType type, + ftl::Flags capabilityFlags, int32_t ordinal) - : name(name), id(id), type(type), ordinal(ordinal) {} + : name(name), id(id), type(type), capabilityFlags(capabilityFlags), ordinal(ordinal) {} // Name string of the light. std::string name; // Light id int32_t id; // Type of the light. InputDeviceLightType type; + // Light capabilities. + ftl::Flags capabilityFlags; // Ordinal of the light int32_t ordinal; }; -- cgit v1.2.3-59-g8ed1b