[PATCH libinput] evdev: use the udev ID_INPUT_POINTINGSTICK property

Hans de Goede hdegoede at redhat.com
Fri May 29 00:31:26 PDT 2015


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>

Regards,

Hans

> ---
>   src/evdev.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 4384177..642f441 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(
>


More information about the wayland-devel mailing list