From 6bb05c594a73cee2ed9cf62af88fdcab4011f57a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 25 Jul 2017 09:38:46 +1000 Subject: lid: disable all types but EV_SYN and EV_SW The lid dispatch interface is a one-trick pony and can only handle SW_LID. It ignores other switches but crashes on any event type other than EV_SW and EV_SYN. Disable those types so we just ignore the event instead of asserting. https://bugs.freedesktop.org/show_bug.cgi?id=101853 Signed-off-by: Peter Hutterer Reviewed-by: Jason Gerecke --- src/evdev-lid.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/evdev-lid.c b/src/evdev-lid.c index b3df37c2..6c438e00 100644 --- a/src/evdev-lid.c +++ b/src/evdev-lid.c @@ -298,6 +298,7 @@ struct evdev_dispatch * evdev_lid_switch_dispatch_create(struct evdev_device *lid_device) { struct lid_switch_dispatch *dispatch; + int type; dispatch = zalloc(sizeof *dispatch); dispatch->base.dispatch_type = DISPATCH_LID_SWITCH; @@ -309,5 +310,12 @@ evdev_lid_switch_dispatch_create(struct evdev_device *lid_device) dispatch->lid_is_closed = false; + for (type = EV_KEY; type < EV_CNT; type++) { + if (type == EV_SW) + continue; + + libevdev_disable_event_type(lid_device->evdev, type); + } + return &dispatch->base; } -- cgit v1.2.3