]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: input_id - use ABS_MT_SLOT{-1} to exclude non touch screen devices
authorAndreas Pokorny <andreas.pokorny@canonical.com>
Mon, 1 Jun 2015 20:43:39 +0000 (22:43 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 2 Jun 2015 22:31:02 +0000 (08:31 +1000)
Peek at the ABS_MT_SLOT-1 axis. Expect that touch screens only
have axes inside the MT range.

src/udev/udev-builtin-input_id.c

index ab90787f6bf005475622ecdb14d3265fdc63b141..e3fa4bc162cd4e1ffdb5cb787dafa21851aa5241 100644 (file)
@@ -171,6 +171,10 @@ static bool test_pointers(struct udev_device *dev,
         has_mouse_button = test_bit(BTN_LEFT, bitmask_key);
         has_rel_coordinates = test_bit(EV_REL, bitmask_ev) && test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel);
         has_mt_coordinates = test_bit(ABS_MT_POSITION_X, bitmask_abs) && test_bit(ABS_MT_POSITION_Y, bitmask_abs);
+
+        /* unset has_mt_coordinates if devices claims to have all abs axis */
+        if(has_mt_coordinates && test_bit(ABS_MT_SLOT, bitmask_abs) && test_bit(ABS_MT_SLOT - 1, bitmask_abs))
+                has_mt_coordinates = false;
         is_direct = test_bit(INPUT_PROP_DIRECT, bitmask_props);
         has_touch = test_bit(BTN_TOUCH, bitmask_key);
         /* joysticks don't necessarily have buttons; e. g.