[PATCH libevdev 6/7] write EV_SYN input_event along with led events to device
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 13 17:50:53 PDT 2013
From: polyphemus <rolfmorel at gmail.com>
Other clients of an evdev device need to have the events they receive
be separated, in moment in time, from other events by an EV_SYN/
SYN_REPORT. This is the responsibility of the client who writes events
into the stream.
---
libevdev/libevdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 25d33e7..ba5b17f 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -1189,7 +1189,7 @@ libevdev_kernel_set_led_value(struct libevdev *dev, unsigned int code, enum Evde
int
libevdev_kernel_set_led_values(struct libevdev *dev, ...)
{
- struct input_event ev[LED_MAX];
+ struct input_event ev[LED_MAX + 1];
enum EvdevLEDValues val;
va_list args;
int code;
@@ -1228,8 +1228,12 @@ libevdev_kernel_set_led_values(struct libevdev *dev, ...)
va_end(args);
if (rc == 0 && nleds > 0) {
+ ev[nleds].type = EV_SYN;
+ ev[nleds++].code = SYN_REPORT;
+
rc = write(libevdev_get_fd(dev), ev, nleds * sizeof(ev[0]));
if (rc > 0) {
+ nleds--; /* last is EV_SYN */
while (nleds--)
update_led_state(dev, &ev[nleds]);
}
--
1.8.2.1
More information about the Input-tools
mailing list