From ec468e8993aae038ba0b0e99cd162d99f7593b18 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 29 May 2015 11:11:56 +1000 Subject: [PATCH] evdev: use the udev ID_INPUT_POINTINGSTICK property Added in systemd 220, but note that for udev backwards compatibility, the ID_INPUT_POINTINGSTICK tag is set in addition to the ID_INPUT_MOUSE tag. And use that property to tag a device as trackpoint too, this allows temporary workarounds for kernel bugs where the input prop isn't set yet. https://bugzilla.redhat.com/show_bug.cgi?id=1225563 Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 4384177f..642f441c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -60,6 +60,7 @@ enum evdev_device_udev_tags { EVDEV_UDEV_TAG_JOYSTICK = (1 << 6), EVDEV_UDEV_TAG_ACCELEROMETER = (1 << 7), EVDEV_UDEV_TAG_BUTTONSET = (1 << 8), + EVDEV_UDEV_TAG_POINTINGSTICK = (1 << 9), }; struct evdev_udev_tag_match { @@ -78,6 +79,7 @@ static const struct evdev_udev_tag_match evdev_udev_tag_matches[] = { {"ID_INPUT_TABLET_PAD", EVDEV_UDEV_TAG_BUTTONSET}, {"ID_INPUT_JOYSTICK", EVDEV_UDEV_TAG_JOYSTICK}, {"ID_INPUT_ACCELEROMETER", EVDEV_UDEV_TAG_ACCELEROMETER}, + {"ID_INPUT_POINTINGSTICK", EVDEV_UDEV_TAG_POINTINGSTICK}, /* sentinel value */ { 0 }, @@ -730,7 +732,10 @@ static void evdev_tag_trackpoint(struct evdev_device *device, struct udev_device *udev_device) { - if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK)) + if (libevdev_has_property(device->evdev, + INPUT_PROP_POINTING_STICK) || + udev_device_get_property_value(udev_device, + "ID_INPUT_POINTINGSTICK")) device->tags |= EVDEV_TAG_TRACKPOINT; } @@ -1839,13 +1844,14 @@ evdev_configure_device(struct evdev_device *device) } log_info(libinput, - "input device '%s', %s is tagged by udev as:%s%s%s%s%s%s%s%s\n", + "input device '%s', %s is tagged by udev as:%s%s%s%s%s%s%s%s%s\n", device->devname, devnode, udev_tags & EVDEV_UDEV_TAG_KEYBOARD ? " Keyboard" : "", udev_tags & EVDEV_UDEV_TAG_MOUSE ? " Mouse" : "", udev_tags & EVDEV_UDEV_TAG_TOUCHPAD ? " Touchpad" : "", udev_tags & EVDEV_UDEV_TAG_TOUCHSCREEN ? " Touchscreen" : "", udev_tags & EVDEV_UDEV_TAG_TABLET ? " Tablet" : "", + udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK ? " Pointingstick" : "", udev_tags & EVDEV_UDEV_TAG_JOYSTICK ? " Joystick" : "", udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER ? " Accelerometer" : "", udev_tags & EVDEV_UDEV_TAG_BUTTONSET ? " Buttonset" : ""); @@ -1904,7 +1910,8 @@ evdev_configure_device(struct evdev_device *device) return device->dispatch == NULL ? -1 : 0; } - if (udev_tags & EVDEV_UDEV_TAG_MOUSE) { + if (udev_tags & EVDEV_UDEV_TAG_MOUSE || + udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK) { if (libevdev_has_event_code(evdev, EV_REL, REL_X) && libevdev_has_event_code(evdev, EV_REL, REL_Y) && evdev_device_init_pointer_acceleration(