mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-27 09:10:07 +01:00
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 <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
parent
4d4293a65b
commit
f29e4118fc
1 changed files with 5 additions and 1 deletions
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue