inputflinger: Initial support for rotary encoders.
This change introduces support for rotary encoder input devices.
We also define a new input source (namely, AINPUT_SOURCE_ROTARY_ENCODER)
and a new axis of input (namely, AXIS_SCROLL), since the rotary encoder
motion doesn't necessarily tie to a horizontal or vertical scroll
motion.
A ROTARY_ENCODER input device class is also introduced, corresponding to
the new input source.
A new input source can be defined as producing rotary encoder motion
events, if its corresponding .idc file contains the following
declaration:
device.type = rotaryEncoder
Bug: 18707397
Change-Id: I8ccd540908311d1ff44fdfeba81b691895413641
Signed-off-by: Prashant Malani <pmalani@google.com>
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 6b60c7c..98cfe2b 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -1177,6 +1177,15 @@
device->classes |= INPUT_DEVICE_CLASS_CURSOR;
}
+ // See if this is a rotary encoder type device.
+ String8 deviceType = String8();
+ if (device->configuration &&
+ device->configuration->tryGetProperty(String8("device.type"), deviceType)) {
+ if (!deviceType.compare(String8("rotaryEncoder"))) {
+ device->classes |= INPUT_DEVICE_CLASS_ROTARY_ENCODER;
+ }
+ }
+
// See if this is a touch pad.
// Is this a new modern multi-touch driver?
if (test_bit(ABS_MT_POSITION_X, device->absBitmask)