From ef100694b45cf6d386851569c25ba699953bff0c Mon Sep 17 00:00:00 2001 From: DanielK Date: Tue, 20 Mar 2012 14:28:43 +0800 Subject: [PATCH] Support old single-touch touchscreens with BTN_LEFT --- services/input/EventHub.cpp | 2 +- services/input/InputReader.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 4d70d5f1ee08..d922a472b225 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -1134,7 +1134,7 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT; } // Is this an old style single-touch driver? - } else if (test_bit(BTN_TOUCH, device->keyBitmask) + } else if ((test_bit(BTN_TOUCH, device->keyBitmask) || test_bit(BTN_LEFT, device->keyBitmask)) && test_bit(ABS_X, device->absBitmask) && test_bit(ABS_Y, device->absBitmask)) { device->classes |= INPUT_DEVICE_CLASS_TOUCH; diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index 03852a5ffcff..0adf04a3a5c9 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -1255,7 +1255,7 @@ TouchButtonAccumulator::TouchButtonAccumulator() : } void TouchButtonAccumulator::configure(InputDevice* device) { - mHaveBtnTouch = device->hasKey(BTN_TOUCH); + mHaveBtnTouch = device->hasKey(BTN_TOUCH) || device->hasKey(BTN_LEFT); mHaveStylus = device->hasKey(BTN_TOOL_PEN) || device->hasKey(BTN_TOOL_RUBBER) || device->hasKey(BTN_TOOL_BRUSH) @@ -1264,7 +1264,7 @@ void TouchButtonAccumulator::configure(InputDevice* device) { } void TouchButtonAccumulator::reset(InputDevice* device) { - mBtnTouch = device->isKeyPressed(BTN_TOUCH); + mBtnTouch = device->isKeyPressed(BTN_TOUCH) || device->isKeyPressed(BTN_LEFT); mBtnStylus = device->isKeyPressed(BTN_STYLUS); mBtnStylus2 = device->isKeyPressed(BTN_STYLUS); mBtnToolFinger = device->isKeyPressed(BTN_TOOL_FINGER); @@ -1301,6 +1301,7 @@ void TouchButtonAccumulator::process(const RawEvent* rawEvent) { if (rawEvent->type == EV_KEY) { switch (rawEvent->code) { case BTN_TOUCH: + case BTN_LEFT: mBtnTouch = rawEvent->value; break; case BTN_STYLUS: -- 2.11.0