]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: input_id: tag accelerometers as ID_INPUT_ACCELEROMETER
authorHans de Goede <hdegoede@redhat.com>
Fri, 3 Apr 2015 10:07:32 +0000 (12:07 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 7 Apr 2015 01:32:36 +0000 (11:32 +1000)
input_id already (tries to) tag accelerometers as such, but this only works
for absolute accelerometers. Recent kernels mark accelerometers through an
input prop. Trust that prop and always tag devices with it with
ID_INPUT_ACCELEROMETER.

Note that detection by the prop bit works the same as the existing detection
and will ensure that no other tags get set on the device.

src/shared/missing.h
src/udev/udev-builtin-input_id.c

index 52d49f75dc125ab4d72c683377583768c6cdb352..21c6afc56c6995dd8e56749af51fcf73a648014c 100644 (file)
@@ -952,3 +952,7 @@ static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, uns
 #ifndef INPUT_PROP_POINTING_STICK
 #define INPUT_PROP_POINTING_STICK 0x05
 #endif
+
+#ifndef INPUT_PROP_ACCELEROMETER
+#define INPUT_PROP_ACCELEROMETER  0x06
+#endif
index d4c38cae6ea41ef5709f613feb6393c86b2dc1bd..ecfc44752793fd8130bd3157eaea4c0d279078c6 100644 (file)
@@ -136,6 +136,11 @@ static void test_pointers (struct udev_device *dev,
         int is_mouse = 0;
         int is_touchpad = 0;
 
+        if (test_bit (INPUT_PROP_ACCELEROMETER, bitmask_props)) {
+                udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1");
+                return;
+        }
+
         if (!test_bit (EV_KEY, bitmask_ev)) {
                 if (test_bit (EV_ABS, bitmask_ev) &&
                     test_bit (ABS_X, bitmask_abs) &&