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/InputReader.h b/services/inputflinger/InputReader.h
index 7cb4680..58db3dc 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -1232,6 +1232,26 @@
};
+class RotaryEncoderInputMapper : public InputMapper {
+public:
+ RotaryEncoderInputMapper(InputDevice* device);
+ virtual ~RotaryEncoderInputMapper();
+
+ virtual uint32_t getSources();
+ virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo);
+ virtual void dump(String8& dump);
+ virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes);
+ virtual void reset(nsecs_t when);
+ virtual void process(const RawEvent* rawEvent);
+
+private:
+ CursorScrollAccumulator mRotaryEncoderScrollAccumulator;
+
+ int32_t mSource;
+
+ void sync(nsecs_t when);
+};
+
class TouchInputMapper : public InputMapper {
public:
TouchInputMapper(InputDevice* device);