summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/EventHub.cpp
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2015-03-13 17:32:02 -0700
committerMichael Wright <michaelwr@google.com>2015-04-17 16:37:16 +0000
commit842500e146cdc0036b2a1a3e2acc7626d005128b (patch)
tree6f780e99fb5df6cb019f46dc1cac085d444ed65c /services/inputflinger/EventHub.cpp
parente5364c8c02f1a943e78dee600ac45573d5cdcbbf (diff)
downloadframeworks_native-842500e146cdc0036b2a1a3e2acc7626d005128b.zip
frameworks_native-842500e146cdc0036b2a1a3e2acc7626d005128b.tar.gz
frameworks_native-842500e146cdc0036b2a1a3e2acc7626d005128b.tar.bz2
Fuse stylus and touch screen data.
TODO: Ensure we dispatch new pressure and button data when stylus is stationary. Change-Id: I10a665a9b81ff4b9acd01bf72f0fc2e0c2abc203
Diffstat (limited to 'services/inputflinger/EventHub.cpp')
-rw-r--r--services/inputflinger/EventHub.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 4d54d56..6b60c7c 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -131,6 +131,13 @@ uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses) {
}
}
+ // External stylus gets the pressure axis
+ if (deviceClasses & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) {
+ if (axis == ABS_PRESSURE) {
+ return INPUT_DEVICE_CLASS_EXTERNAL_STYLUS;
+ }
+ }
+
// Joystick devices get the rest.
return deviceClasses & INPUT_DEVICE_CLASS_JOYSTICK;
}
@@ -1185,6 +1192,16 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
&& test_bit(ABS_X, device->absBitmask)
&& test_bit(ABS_Y, device->absBitmask)) {
device->classes |= INPUT_DEVICE_CLASS_TOUCH;
+ // Is this a BT stylus?
+ } else if ((test_bit(ABS_PRESSURE, device->absBitmask) ||
+ test_bit(BTN_TOUCH, device->keyBitmask))
+ && !test_bit(ABS_X, device->absBitmask)
+ && !test_bit(ABS_Y, device->absBitmask)) {
+ device->classes |= INPUT_DEVICE_CLASS_EXTERNAL_STYLUS;
+ // Keyboard will try to claim some of the buttons but we really want to reserve those so we
+ // can fuse it with the touch screen data, so just take them back. Note this means an
+ // external stylus cannot also be a keyboard device.
+ device->classes &= ~INPUT_DEVICE_CLASS_KEYBOARD;
}
// See if this device is a joystick.