[PATCH libinput 2/9] evdev: Avoid double touch down/up events

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 9 22:44:33 PDT 2014


On Wed, Apr 09, 2014 at 09:02:09PM +0200, Jonas Ådahl wrote:
> When the kernel sends multiple touch down or touch up for the same slot
> in a row, ignore any such subsequent event ensuring libinput always
> produces 1 x touch down -> [n x touch motion] -> 1 x touch up event
> series.

fwiw, libevdev is about to handle this in 1.2 once I get the current patches
reviewed. This is a kernel issue, it does duplicate removal for all events
but EV_ABS and that's where the duplicate tracking ID comes from which then
again triggers the duplicate touch downs/ups.

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
though I wouldn't mind error messages for this, this event is clearly a bug.

I mentioned this to Hans off-list in a related email, I think we should
consider adding a log_bug() macro for these things. It certainly helped me
a lot in the server to be able to say "if this ever happens, this is a bug".

Cheers,
   Peter

> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  src/evdev.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index cc0c4bf..b6aaf57 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -132,6 +132,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
>  		if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
>  			break;
>  
> +		if (device->mt.slots[slot].seat_slot != -1)
> +			break;
> +
>  		seat_slot = ffs(~seat->slot_map) - 1;
>  		device->mt.slots[slot].seat_slot = seat_slot;
>  
> @@ -162,6 +165,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
>  			break;
>  
>  		seat_slot = device->mt.slots[slot].seat_slot;
> +		device->mt.slots[slot].seat_slot = -1;
>  
>  		if (seat_slot == -1)
>  			break;
> @@ -174,6 +178,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
>  		if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
>  			break;
>  
> +		if (device->abs.seat_slot != -1)
> +			break;
> +
>  		seat_slot = ffs(~seat->slot_map) - 1;
>  		device->abs.seat_slot = seat_slot;
>  
> @@ -209,6 +216,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
>  			break;
>  
>  		seat_slot = device->abs.seat_slot;
> +		device->abs.seat_slot = -1;
>  
>  		if (seat_slot == -1)
>  			break;
> @@ -713,6 +721,7 @@ evdev_device_create(struct libinput_seat *seat,
>  
>  	libinput_seat_ref(seat);
>  
> +	device->abs.seat_slot = -1;
>  	device->mt.slot = -1;
>  	device->mt.slots = NULL;
>  	device->mt.slots_len = 0;
> -- 
> 1.8.3.2
 


More information about the wayland-devel mailing list