From: polyphemus Date: Fri, 9 Aug 2013 15:38:51 +0000 (+0200) Subject: write EV_SYN input_event along with led events to device X-Git-Tag: libevdev-0.4~60^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f29e4118fcbc58ad79561e64f7ede15f59224240;p=platform%2Fupstream%2Flibevdev.git write EV_SYN input_event along with led events to device 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 Reviewed-by: Benjamin Tissoires --- 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]); }