summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2014-03-10 08:54:22 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2014-03-10 08:54:22 +0100
commit2658624399b22a9c4a345a22c69886dc9417f801 (patch)
tree33f8457cf0c05e27e2493cf5b98e7816a27fd9d4
parent7abaad1ab099b077ebd6452b14ef351483831245 (diff)
input_id: Recognize buttonless joystick types
Input devices like rudders or pedals are joystick-like; they don't have buttons, but axes like RX, THROTTLE, or RUDDER. These don't interfere with other device types with absolute axes (touch screens, touchpads, and accelerometers), so it's fairly safe to mark them as ID_INPUT_JOYSTICK and thus hand out dynamic ACLs to the user. https://bugs.freedesktop.org/show_bug.cgi?id=70734
-rw-r--r--src/udev/udev-builtin-input_id.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 828b349d9c..3b2e8975f5 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -116,16 +116,27 @@ static void test_pointers (struct udev_device *dev,
udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1");
else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key))
is_touchpad = 1;
- else if (test_bit (BTN_TRIGGER, bitmask_key) ||
- test_bit (BTN_A, bitmask_key) ||
- test_bit (BTN_1, bitmask_key))
- udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1");
else if (test_bit (BTN_MOUSE, bitmask_key))
/* This path is taken by VMware's USB mouse, which has
* absolute axes, but no touch/pressure button. */
is_mouse = 1;
else if (test_bit (BTN_TOUCH, bitmask_key))
udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1");
+ /* joysticks don't necessarily have to have buttons; e. g.
+ * rudders/pedals are joystick-like, but buttonless; they have
+ * other fancy axes */
+ else if (test_bit (BTN_TRIGGER, bitmask_key) ||
+ test_bit (BTN_A, bitmask_key) ||
+ test_bit (BTN_1, bitmask_key) ||
+ test_bit (ABS_RX, bitmask_abs) ||
+ test_bit (ABS_RY, bitmask_abs) ||
+ test_bit (ABS_RZ, bitmask_abs) ||
+ test_bit (ABS_THROTTLE, bitmask_abs) ||
+ test_bit (ABS_RUDDER, bitmask_abs) ||
+ test_bit (ABS_WHEEL, bitmask_abs) ||
+ test_bit (ABS_GAS, bitmask_abs) ||
+ test_bit (ABS_BRAKE, bitmask_abs))
+ udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1");
}
if (test_bit (EV_REL, bitmask_ev) &&