[PATCH 1/2 weston] evdev: Only use device as pointer if EV_REL and EV_KEY are set.

Jonas Ådahl jadahl at gmail.com
Mon Aug 6 02:52:48 PDT 2012


On Mon, Aug 6, 2012 at 9:27 AM, Scott Moreau <oreaus at gmail.com> wrote:
> A standard mouse should not have EV_ABS as part of its capabilities, however it
> should have both EV_REL and EV_KEY. This attempts to avoid erroneously detecting
> devices as pointers, such as joysticks for example.

This will potentially break the current touchpad support since an
evdev touchpad driver doesn't provide EV_REL events. A question that
arises is what the capabilities enum mean. Should they describe what
input events should be read or should it describe what input events
will be written?

As per discussion on IRC it would make sense to realize the meaning of
the capabilities enum to what will be written by the driver, and since
the touchpad driver reads absolute events, but writes relative events,
it should have the capability EVDEV_MOTION_REL, and not
EVDEV_MOTION_ABS. It would also mean that it should unset possible
support for EVDEV_TOUCH since it won't write any such events.

Jonas

> ---
>  src/evdev.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 7d93564..c08a4ae 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -372,7 +372,7 @@ evdev_configure_device(struct evdev_input_device *device)
>         unsigned long rel_bits[NBITS(REL_MAX)];
>         unsigned long key_bits[NBITS(KEY_MAX)];
>         int has_key, has_abs;
> -       unsigned int i;
> +       unsigned int i, pointer_caps_mask;
>
>         has_key = 0;
>         has_abs = 0;
> @@ -453,8 +453,9 @@ evdev_configure_device(struct evdev_input_device *device)
>                 return -1;
>         }
>
> -       if ((device->caps &
> -            (EVDEV_MOTION_ABS | EVDEV_MOTION_REL | EVDEV_BUTTON))) {
> +       pointer_caps_mask = (EVDEV_MOTION_REL | EVDEV_BUTTON);
> +
> +       if ((device->caps & pointer_caps_mask) == pointer_caps_mask) {
>                 weston_seat_init_pointer(device->seat);
>                 weston_log("input device %s, %s is a pointer\n",
>                            device->devname, device->devnode);
> --
> 1.7.11.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list