evdev: Drop obsolete accelerometer reject rule
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 16 Dec 2013 23:37:16 +0000 (15:37 -0800)
committerJonas Ådahl <jadahl@gmail.com>
Sat, 21 Dec 2013 11:51:52 +0000 (12:51 +0100)
This rule triggers for devices with an ABS_X/Y evaluators and no
keyboard or multitouch events.  There is no way we would ever add such
a device as a pointer, keyboard or touch device anyway.  A pointer
device requires has_button (in which case the !has_key condtion would
fail); a keyboard device would also mean !has_key is false and a touch
screen device implies that !device->is_mt is false.

src/evdev.c

index adaaa81..2289e7f 100644 (file)
@@ -473,11 +473,10 @@ evdev_configure_device(struct evdev_device *device)
        unsigned long abs_bits[NBITS(ABS_MAX)];
        unsigned long rel_bits[NBITS(REL_MAX)];
        unsigned long key_bits[NBITS(KEY_MAX)];
-       int has_key, has_abs, has_rel, has_mt;
+       int has_abs, has_rel, has_mt;
        int has_button, has_keyboard, has_touch;
        unsigned int i;
 
-       has_key = 0;
        has_rel = 0;
        has_abs = 0;
        has_mt = 0;
@@ -546,7 +545,6 @@ evdev_configure_device(struct evdev_device *device)
                        has_rel = 1;
        }
        if (TEST_BIT(ev_bits, EV_KEY)) {
-               has_key = 1;
                ioctl(device->fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)),
                      key_bits);
                if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
@@ -574,12 +572,6 @@ evdev_configure_device(struct evdev_device *device)
        if (TEST_BIT(ev_bits, EV_LED))
                has_keyboard = 1;
 
-       /* This rule tries to catch accelerometer devices and opt out. We may
-        * want to adjust the protocol later adding a proper event for dealing
-        * with accelerometers and implement here accordingly */
-       if (has_abs && !has_key && !device->is_mt)
-               return 0;
-
        if ((has_abs || has_rel) && has_button)
                device->seat_caps |= EVDEV_DEVICE_POINTER;
        if (has_keyboard)