[PATCH libinput] evdev: use the udev ID_INPUT_POINTINGSTICK property

Peter Hutterer peter.hutterer at who-t.net
Sun May 31 21:08:19 PDT 2015


On Sat, May 30, 2015 at 12:10:28PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 29-05-15 17:06, Benjamin Tissoires wrote:
> >
> >
> >On 05/29/2015 03:31 AM, Hans de Goede wrote:
> >>Hi,
> >>
> >>On 29-05-15 03:28, Peter Hutterer wrote:
> >>>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 <peter.hutterer at who-t.net>
> >>
> >>LGTM: Reviewed-by: Hans de Goede <hdegoede at redhat.com>
> >>
> >
> >Yep, as Hans said, this looks good to me (it's already push, so that
> >does not matter that much).
> >
> >However, for completeness, if we want to be able to override the
> >INPUT_PROP_POINTING_STICK property, we also need the following patch:
> >
> >
> > From 9573bfb574a74e2eea89a9227aaf67c1c9403983 Mon Sep 17 00:00:00 2001
> >From: Benjamin Tissoires <benjamin.tissoires at gmail.com>
> >Date: Fri, 29 May 2015 11:02:12 -0400
> >Subject: [PATCH] evdev: remove direct checks for INPUT_PROP_POINTING_STICK
> >
> >If we need to temporary override a device with ID_INPUT_POINTINGSTICK,
> >evdev sets the tag EVDEV_TAG_TRACKPOINT to the device. Rely on the tag
> >to behave properly for scroll emulation.
> >
> >Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
> 
> Hmm, IIRC some of these code-paths run before the tags get set,
> so this will not work. Did you check for this?

Hans is right, the tag isn't set until after the device is set up. This
could probably be moved up, though the external mouse tagging needs a fix
for that.

Cheers,
   Peter


> >---
> >  src/evdev.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/src/evdev.c b/src/evdev.c
> >index 642f441..a996bcf 100644
> >--- a/src/evdev.c
> >+++ b/src/evdev.c
> >@@ -1070,7 +1070,7 @@ evdev_scroll_get_default_method(struct libinput_device *device)
> >  {
> >  	struct evdev_device *evdev = (struct evdev_device *)device;
> >
> >-	if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
> >+	if (evdev->tags & EVDEV_TAG_TRACKPOINT)
> >  		return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
> >
> >  	/* Mice without a scroll wheel but with middle button have on-button
> >@@ -1110,7 +1110,7 @@ evdev_scroll_get_default_button(struct libinput_device *device)
> >  {
> >  	struct evdev_device *evdev = (struct evdev_device *)device;
> >
> >-	if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
> >+	if (evdev->tags & EVDEV_TAG_TRACKPOINT)
> >  		return BTN_MIDDLE;
> >
> >  	/* A device that defaults to button scrolling defaults
> >@@ -1505,7 +1505,7 @@ evdev_read_dpi_prop(struct evdev_device *device)
> >  	 * POINTINGSTICK_CONST_ACCEL value to compensate for sensitivity
> >  	 * differences between models, we translate this to a fake dpi.
> >  	 */
> >-	if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK))
> >+	if (device->tags & EVDEV_TAG_TRACKPOINT)
> >  		return evdev_get_trackpoint_dpi(device);
> >
> >  	mouse_dpi = udev_device_get_property_value(device->udev_device,
> >


More information about the wayland-devel mailing list