[PATCH libevdev 2/3] Make sure EV_SYN is always set

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 23 22:14:29 PDT 2013


Set the bit during device reset and make sure that if we're checking
for the event type we always return true for EV_SYN.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 libevdev/libevdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 8315d9b..7bebe32 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -120,6 +120,7 @@ libevdev_reset(struct libevdev *dev)
 	dev->current_slot = -1;
 	dev->grabbed = LIBEVDEV_UNGRAB;
 	dev->sync_state = SYNC_NONE;
+	libevdev_enable_event_type(dev, EV_SYN);
 }
 
 LIBEVDEV_EXPORT struct libevdev*
@@ -944,7 +945,7 @@ libevdev_enable_property(struct libevdev *dev, unsigned int prop)
 LIBEVDEV_EXPORT int
 libevdev_has_event_type(const struct libevdev *dev, unsigned int type)
 {
-	return (type <= EV_MAX) && bit_is_set(dev->bits, type);
+	return type == EV_SYN ||(type <= EV_MAX && bit_is_set(dev->bits, type));
 }
 
 LIBEVDEV_EXPORT int
-- 
1.8.3.1



More information about the Input-tools mailing list