[PATCH libinput] evdev: Pass along device overflow information

Derek Foreman derekf at osg.samsung.com
Mon Oct 27 07:28:32 PDT 2014


On 26/10/14 11:11 PM, Peter Hutterer wrote:
> On Fri, Oct 24, 2014 at 01:18:06PM -0500, Derek Foreman wrote:
>> Currently libinput users just see choppy input if the kernel event queue
>> overflows.  This patch passes along an event so the caller can at least
>> log it.
> 
> any reason you didn't just log it through libinput if that's all you want to
> do?
> 
> not a big fan of having an event for what is essentially an implementation
> detail in the public API.

That's fair - I guess there's nothing the caller can (or should) do in
response to this anyway.

New patch to follow.

> Cheers,
>    Peter
> 
>> ---
>>  src/evdev.c            |  1 +
>>  src/libinput-private.h |  3 +++
>>  src/libinput.c         | 18 ++++++++++++++++++
>>  src/libinput.h         |  5 +++++
>>  4 files changed, 27 insertions(+)
>>
>> diff --git a/src/evdev.c b/src/evdev.c
>> index d8e3e5a..157bed7 100644
>> --- a/src/evdev.c
>> +++ b/src/evdev.c
>> @@ -929,6 +929,7 @@ evdev_device_dispatch(void *data)
>>  			   to the current state */
>>  			ev.code = SYN_REPORT;
>>  			evdev_device_dispatch_one(device, &ev);
>> +			notify_overflowed_device(&device->base);
>>  
>>  			rc = evdev_sync_device(device);
>>  			if (rc == 0)
>> diff --git a/src/libinput-private.h b/src/libinput-private.h
>> index 5a975d9..4606565 100644
>> --- a/src/libinput-private.h
>> +++ b/src/libinput-private.h
>> @@ -212,6 +212,9 @@ void
>>  notify_removed_device(struct libinput_device *device);
>>  
>>  void
>> +notify_overflowed_device(struct libinput_device *device);
>> +
>> +void
>>  keyboard_notify_key(struct libinput_device *device,
>>  		    uint32_t time,
>>  		    uint32_t key,
>> diff --git a/src/libinput.c b/src/libinput.c
>> index 5780a92..81528b7 100644
>> --- a/src/libinput.c
>> +++ b/src/libinput.c
>> @@ -171,6 +171,7 @@ libinput_event_get_pointer_event(struct libinput_event *event)
>>  		abort(); /* not used as actual event type */
>>  	case LIBINPUT_EVENT_DEVICE_ADDED:
>>  	case LIBINPUT_EVENT_DEVICE_REMOVED:
>> +	case LIBINPUT_EVENT_DEVICE_OVERFLOW:
>>  	case LIBINPUT_EVENT_KEYBOARD_KEY:
>>  		break;
>>  	case LIBINPUT_EVENT_POINTER_MOTION:
>> @@ -197,6 +198,7 @@ libinput_event_get_keyboard_event(struct libinput_event *event)
>>  		abort(); /* not used as actual event type */
>>  	case LIBINPUT_EVENT_DEVICE_ADDED:
>>  	case LIBINPUT_EVENT_DEVICE_REMOVED:
>> +	case LIBINPUT_EVENT_DEVICE_OVERFLOW:
>>  		break;
>>  	case LIBINPUT_EVENT_KEYBOARD_KEY:
>>  		return (struct libinput_event_keyboard *) event;
>> @@ -223,6 +225,7 @@ libinput_event_get_touch_event(struct libinput_event *event)
>>  		abort(); /* not used as actual event type */
>>  	case LIBINPUT_EVENT_DEVICE_ADDED:
>>  	case LIBINPUT_EVENT_DEVICE_REMOVED:
>> +	case LIBINPUT_EVENT_DEVICE_OVERFLOW:
>>  	case LIBINPUT_EVENT_KEYBOARD_KEY:
>>  	case LIBINPUT_EVENT_POINTER_MOTION:
>>  	case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
>> @@ -248,6 +251,7 @@ libinput_event_get_device_notify_event(struct libinput_event *event)
>>  		abort(); /* not used as actual event type */
>>  	case LIBINPUT_EVENT_DEVICE_ADDED:
>>  	case LIBINPUT_EVENT_DEVICE_REMOVED:
>> +	case LIBINPUT_EVENT_DEVICE_OVERFLOW:
>>  		return (struct libinput_event_device_notify *) event;
>>  	case LIBINPUT_EVENT_KEYBOARD_KEY:
>>  	case LIBINPUT_EVENT_POINTER_MOTION:
>> @@ -831,6 +835,20 @@ notify_removed_device(struct libinput_device *device)
>>  }
>>  
>>  void
>> +notify_overflowed_device(struct libinput_device *device)
>> +{
>> +	struct libinput_event_device_notify *overflowed_device_event;
>> +
>> +	overflowed_device_event = zalloc(sizeof *overflowed_device_event);
>> +	if (!overflowed_device_event)
>> +		return;
>> +
>> +	post_base_event(device,
>> +			LIBINPUT_EVENT_DEVICE_OVERFLOW,
>> +			&overflowed_device_event->base);
>> +}
>> +
>> +void
>>  keyboard_notify_key(struct libinput_device *device,
>>  		    uint32_t time,
>>  		    uint32_t key,
>> diff --git a/src/libinput.h b/src/libinput.h
>> index 9cc6f52..39c9f92 100644
>> --- a/src/libinput.h
>> +++ b/src/libinput.h
>> @@ -230,6 +230,11 @@ enum libinput_event_type {
>>  	 */
>>  	LIBINPUT_EVENT_DEVICE_REMOVED,
>>  
>> +	/**
>> +	 * Signals that the kernel event queue for the device has overflowed.
>> +	 */
>> +	LIBINPUT_EVENT_DEVICE_OVERFLOW,
>> +
>>  	LIBINPUT_EVENT_KEYBOARD_KEY = 300,
>>  
>>  	LIBINPUT_EVENT_POINTER_MOTION = 400,
>> -- 
>> 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