[systemd-commits] src/udev

Martin Pitt martin at kemper.freedesktop.org
Mon Mar 10 00:57:32 PDT 2014


 src/udev/udev-builtin-input_id.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 2658624399b22a9c4a345a22c69886dc9417f801
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Mar 10 08:54:22 2014 +0100

    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 828b349..3b2e897 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) &&



More information about the systemd-commits mailing list