summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-04-03 12:07:32 +0200
committerAnthony G. Basile <blueness@gentoo.org>2015-04-12 11:48:23 -0400
commitce18923774d4f8579843b662b4b9c1d3865fb6fc (patch)
treecb8d4ccaddffbdabe6c1e94e5529401836943a4f /src
parent5ee5fee016106cf9095431f11c0204b98a5ba69b (diff)
udev: input_id: tag accelerometers as ID_INPUT_ACCELEROMETER
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. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/shared/missing.h4
-rw-r--r--src/udev/udev-builtin-input_id.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/missing.h b/src/shared/missing.h
index f73140d71b..a5cf627373 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -146,3 +146,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
#ifndef INPUT_PROP_POINTING_STICK
#define INPUT_PROP_POINTING_STICK 0x05
#endif
+
+#ifndef INPUT_PROP_ACCELEROMETER
+#define INPUT_PROP_ACCELEROMETER 0x06
+#endif
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index d4c38cae6e..ecfc447527 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -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) &&