[PATCH libinput 1/2] touchpad: check touchpad for basic features we expect
Hans de Goede
hdegoede at redhat.com
Fri May 29 00:31:05 PDT 2015
Hi,
Both patch LGTM, series is:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
On 29-05-15 00:21, Peter Hutterer wrote:
> If a relative device is tagged by udev as ID_INPUT_TOUCHPAD we need to
> catch this before we try to dereference device->abs.absinfo_x.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/evdev-mt-touchpad.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index b18f74e..eacec6e 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1440,6 +1440,30 @@ tp_init_sendevents(struct tp_dispatch *tp,
> }
>
> static int
> +tp_sanity_check(struct tp_dispatch *tp,
> + struct evdev_device *device)
> +{
> + struct libevdev *evdev = device->evdev;
> + struct libinput *libinput = tp_libinput_context(tp);
> +
> + if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X))
> + goto error;
> +
> + if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH))
> + goto error;
> +
> + if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER))
> + goto error;
> +
> + return 0;
> +
> +error:
> + log_bug_kernel(libinput,
> + "device %s failed touchpad sanity checks\n");
> + return -1;
> +}
> +
> +static int
> tp_init(struct tp_dispatch *tp,
> struct evdev_device *device)
> {
> @@ -1449,6 +1473,9 @@ tp_init(struct tp_dispatch *tp,
> tp->base.interface = &tp_interface;
> tp->device = device;
>
> + if (tp_sanity_check(tp, device) != 0)
> + return -1;
> +
> if (tp_init_slots(tp, device) != 0)
> return -1;
>
>
More information about the wayland-devel
mailing list