diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2014-03-10 08:54:22 +0100 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-03-17 12:02:40 -0400 |
commit | 2d98bf75697e992831d5cae7fd12947c4b393146 (patch) | |
tree | 6438b1b1508bbeb03205d39206372489dce77c10 /src | |
parent | 10e0d09f138b4e124cd1333e5d71051ea1a08103 (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
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udev-builtin-input_id.c | 19 |
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) && |