[PATCH libevdev] Don't bother sanitizing disabled event codes
Benjamin Tissoires
benjamin.tissoires at gmail.com
Wed Aug 17 07:19:29 UTC 2016
On Wed, Aug 17, 2016 at 2:58 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Filter them immediately instead of passing them on and relying on the actual
> event handling code to filter them.
>
> Reproducer: if EV_ABS is disabled on an Apple MagicMouse we still get events
> passed into sanitize_event(). But the code handling EV_ABS events doesn't
> update the state, so we end up complaining about double tracking IDs, even
> though that is not actually correct.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1361325
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Works for me:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
Cheers,
Benjamin
> ---
> libevdev/libevdev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index 48b49b1..43a095c 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -979,6 +979,9 @@ sanitize_event(const struct libevdev *dev,
> struct input_event *ev,
> enum SyncState sync_state)
> {
> + if (!libevdev_has_event_code(dev, ev->type, ev->code))
> + return EVENT_FILTER_DISCARD;
> +
> if (unlikely(dev->num_slots > -1 &&
> libevdev_event_is_code(ev, EV_ABS, ABS_MT_SLOT) &&
> (ev->value < 0 || ev->value >= dev->num_slots))) {
> --
> 2.7.4
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/input-tools
More information about the Input-tools
mailing list