[PATCH libinput v2] evdev: Log evdev event queue overflows

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 30 17:14:48 PDT 2014


On Wed, Oct 29, 2014 at 09:56:27AM -0500, Derek Foreman wrote:
> Log a message when the kernel event queue overflows and events are dropped.
> After 10 messages logging stops to avoid flooding the logs if the condition
> is persistent.

merged locally, thanks. but please sign off your patches to libinput. Can I
assume your s-o-b for this patch?

Cheers,
   Peter

> ---
>  src/evdev.c | 11 +++++++++++
>  src/evdev.h |  4 ++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index 1b4ce10..9026f5c 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -924,6 +924,17 @@ evdev_device_dispatch(void *data)
>  		rc = libevdev_next_event(device->evdev,
>  					 LIBEVDEV_READ_FLAG_NORMAL, &ev);
>  		if (rc == LIBEVDEV_READ_STATUS_SYNC) {
> +			if (device->syn_drops_received < 10) {
> +				device->syn_drops_received++;
> +				log_info(libinput, "SYN_DROPPED event from "
> +					 "\"%s\" - some input events have "
> +					 "been lost.\n", device->devname);
> +				if (device->syn_drops_received == 10)
> +					log_info(libinput, "No longer logging "
> +						 "SYN_DROPPED events for "
> +						 "\"%s\"\n", device->devname);
> +			}
> +
>  			/* send one more sync event so we handle all
>  			   currently pending events before we sync up
>  			   to the current state */
> diff --git a/src/evdev.h b/src/evdev.h
> index c0d6577..9e84623 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -135,6 +135,10 @@ struct evdev_device {
>  		/* Checks if buttons are down and commits the setting */
>  		void (*change_to_left_handed)(struct evdev_device *device);
>  	} buttons;
> +
> +	/* The number of times libevdev processes a SYN_DROPPED, so we can
> +	 * stop logging them to avoid flooding the logs. */
> +	int syn_drops_received;
>  };
>  
>  #define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1)
> -- 
> 2.1.1
> 
> _______________________________________________
> 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