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.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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;
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]);
}