Configure device classes for evdev devices.
Change-Id: Ia75b71253771d9d558c59411e27f8a51e352fb8b
diff --git a/modules/input/evdev/InputDevice.h b/modules/input/evdev/InputDevice.h
index 7a99f90..b4f3244 100644
--- a/modules/input/evdev/InputDevice.h
+++ b/modules/input/evdev/InputDevice.h
@@ -21,6 +21,7 @@
#include <utils/Timers.h>
+#include "InputHost.h"
#include "InputHub.h"
namespace android {
@@ -33,6 +34,7 @@
public:
virtual void processInput(InputEvent& event, nsecs_t currentTime) = 0;
+ virtual uint32_t getInputClasses() = 0;
protected:
InputDeviceInterface() = default;
virtual ~InputDeviceInterface() = default;
@@ -43,18 +45,69 @@
*/
class EvdevDevice : public InputDeviceInterface {
public:
- explicit EvdevDevice(const std::shared_ptr<InputDeviceNode>& node);
+ EvdevDevice(InputHost host, const std::shared_ptr<InputDeviceNode>& node);
virtual ~EvdevDevice() override = default;
virtual void processInput(InputEvent& event, nsecs_t currentTime) override;
+ virtual uint32_t getInputClasses() override { return mClasses; }
private:
+ InputHost mHost;
std::shared_ptr<InputDeviceNode> mDeviceNode;
+ InputDeviceIdentifier mInputId;
+ uint32_t mClasses = 0;
int32_t mOverrideSec = 0;
int32_t mOverrideUsec = 0;
};
+/* Input device classes. */
+enum {
+ /* The input device is a keyboard or has buttons. */
+ INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001,
+
+ /* The input device is an alpha-numeric keyboard (not just a dial pad). */
+ INPUT_DEVICE_CLASS_ALPHAKEY = 0x00000002,
+
+ /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */
+ INPUT_DEVICE_CLASS_TOUCH = 0x00000004,
+
+ /* The input device is a cursor device such as a trackball or mouse. */
+ INPUT_DEVICE_CLASS_CURSOR = 0x00000008,
+
+ /* The input device is a multi-touch touchscreen. */
+ INPUT_DEVICE_CLASS_TOUCH_MT = 0x00000010,
+
+ /* The input device is a directional pad (implies keyboard, has DPAD keys). */
+ INPUT_DEVICE_CLASS_DPAD = 0x00000020,
+
+ /* The input device is a gamepad (implies keyboard, has BUTTON keys). */
+ INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040,
+
+ /* The input device has switches. */
+ INPUT_DEVICE_CLASS_SWITCH = 0x00000080,
+
+ /* The input device is a joystick (implies gamepad, has joystick absolute axes). */
+ INPUT_DEVICE_CLASS_JOYSTICK = 0x00000100,
+
+ /* The input device has a vibrator (supports FF_RUMBLE). */
+ INPUT_DEVICE_CLASS_VIBRATOR = 0x00000200,
+
+ /* The input device has a microphone. */
+ // TODO: remove this and let the host take care of it
+ INPUT_DEVICE_CLASS_MIC = 0x00000400,
+
+ /* The input device is an external stylus (has data we want to fuse with touch data). */
+ INPUT_DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800,
+
+ /* The input device is virtual (not a real device, not part of UI configuration). */
+ /* not used - INPUT_DEVICE_CLASS_VIRTUAL = 0x40000000, */
+
+ /* The input device is external (not built-in). */
+ // TODO: remove this and let the host take care of it?
+ INPUT_DEVICE_CLASS_EXTERNAL = 0x80000000,
+};
+
} // namespace android
#endif // ANDROID_INPUT_DEVICE_H_