uinput: use named initializers for the event struct
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 5 Jul 2022 04:02:23 +0000 (14:02 +1000)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 17 Nov 2023 10:55:47 +0000 (19:55 +0900)
With the 64 bit timestamps, the struct layout changes into a flatter
version, so let's use the input_event_(u)sec helpers to transparently
handle this.

Fixes #25

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libevdev/libevdev-uinput.c

index 6773e91189a461c2045a9022bdcd37482cc74969..37939d57e82e62e6531adec1dd4adbb68ba24c53 100644 (file)
@@ -468,7 +468,13 @@ libevdev_uinput_write_event(const struct libevdev_uinput *uinput_dev,
                            unsigned int code,
                            int value)
 {
-       struct input_event ev = { {0,0}, type, code, value };
+       struct input_event ev = {
+               .input_event_sec = 0,
+               .input_event_usec = 0,
+               .type = type,
+               .code = code,
+               .value = value
+       };
        int fd = libevdev_uinput_get_fd(uinput_dev);
        int rc, max;