evdev: Ignore joystick devices
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 13 Aug 2013 21:55:39 +0000 (14:55 -0700)
committerJonas Ådahl <jadahl@gmail.com>
Sun, 10 Nov 2013 16:51:33 +0000 (17:51 +0100)
We don't handle them in any way now and having your steering wheel move
the cursor isn't useful.  Applications can still open evdev devices and
access them directly like they already do.

src/evdev.c

index 2966b612d5d557fe84227ed0657ac0444c8ec922..26fe866590974c441fec793ef35bfea9ffddc8ac 100644 (file)
@@ -445,6 +445,16 @@ evdev_handle_device(struct evdev_device *device)
 
                ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
                      abs_bits);
+
+               if (TEST_BIT(abs_bits, ABS_WHEEL) ||
+                   TEST_BIT(abs_bits, ABS_GAS) ||
+                   TEST_BIT(abs_bits, ABS_BRAKE) ||
+                   TEST_BIT(abs_bits, ABS_HAT0X)) {
+                       weston_log("device %s is a joystick, ignoring\n",
+                                  device->devnode);
+                       return 0;
+               }
+
                if (TEST_BIT(abs_bits, ABS_X)) {
                        ioctl(device->fd, EVIOCGABS(ABS_X), &absinfo);
                        device->abs.min_x = absinfo.minimum;