summaryrefslogtreecommitdiff
path: root/include/input/InputDevice.h
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2022-09-12 13:36:48 +0000
committer Vaibhav Devmurari <vdevmurari@google.com> 2022-09-22 21:57:25 +0000
commit82b37d6e0bc12bd7218d2986df061320069f962a (patch)
treea663b227765f9984a678a773311976b411755e22 /include/input/InputDevice.h
parent52b3c475ed1c6cab0c5e232a3aeb68706c5b22bf (diff)
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
Diffstat (limited to 'include/input/InputDevice.h')
-rw-r--r--include/input/InputDevice.h20
1 files changed, 15 insertions, 5 deletions
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 <android/sensor.h>
+#include <ftl/flags.h>
#include <input/Input.h>
#include <input/KeyCharacterMap.h>
#include <unordered_map>
@@ -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<InputDeviceLightCapability> 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<InputDeviceLightCapability> capabilityFlags;
// Ordinal of the light
int32_t ordinal;
};