Input: MT - Allow legacy pressure computation
authorHenrik Rydberg <rydberg@euromail.se>
Sat, 15 Sep 2012 06:57:18 +0000 (08:57 +0200)
committerHenrik Rydberg <rydberg@euromail.se>
Wed, 19 Sep 2012 17:50:19 +0000 (19:50 +0200)
Some drivers like to report ABS_PRESSURE in a special way.
Allow this when ABS_MT_PRESSURE is not defined.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
drivers/input/input-mt.c

index 44f5a67aaa691927b35e446e512c3d646bd897b9..c0ec7d42c3be05ffd574daec1870d44d560ed15a 100644 (file)
@@ -214,13 +214,17 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
        if (oldest) {
                int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
                int y = input_mt_get_value(oldest, ABS_MT_POSITION_Y);
-               int p = input_mt_get_value(oldest, ABS_MT_PRESSURE);
 
                input_event(dev, EV_ABS, ABS_X, x);
                input_event(dev, EV_ABS, ABS_Y, y);
-               input_event(dev, EV_ABS, ABS_PRESSURE, p);
+
+               if (test_bit(ABS_MT_PRESSURE, dev->absbit)) {
+                       int p = input_mt_get_value(oldest, ABS_MT_PRESSURE);
+                       input_event(dev, EV_ABS, ABS_PRESSURE, p);
+               }
        } else {
-               input_event(dev, EV_ABS, ABS_PRESSURE, 0);
+               if (test_bit(ABS_MT_PRESSURE, dev->absbit))
+                       input_event(dev, EV_ABS, ABS_PRESSURE, 0);
        }
 }
 EXPORT_SYMBOL(input_mt_report_pointer_emulation);