From: Martin Pitt Date: Mon, 10 Mar 2014 07:54:22 +0000 (+0100) Subject: input_id: Recognize buttonless joystick types X-Git-Tag: v211~48 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=2658624399b22a9c4a345a22c69886dc9417f801;ds=sidebyside 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 --- diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 828b349d9..3b2e8975f 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) &&