OSDN Git Service

Support old single-touch touchscreens with BTN_LEFT
authorDanielK <daniel.kenzelmann@googlemail.com>
Tue, 20 Mar 2012 06:28:43 +0000 (14:28 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 10 Dec 2017 15:11:52 +0000 (23:11 +0800)
services/inputflinger/EventHub.cpp
services/inputflinger/InputReader.cpp

index 50589b4..3f45adb 100644 (file)
@@ -1249,7 +1249,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;
index d4266f6..815d540 100644 (file)
@@ -1495,7 +1495,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)
@@ -1504,7 +1504,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);
     // BTN_0 is what gets mapped for the HID usage Digitizers.SecondaryBarrelSwitch
     mBtnStylus2 =
@@ -1543,6 +1543,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: