@@ -193,13 +193,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput,
{
VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput);
struct input_event evdev;
+ struct timeval tv;
int rc;
- if (gettimeofday(&evdev.time, NULL)) {
+ if (gettimeofday(&tv, NULL)) {
perror("virtio_input_host_handle_status: gettimeofday");
return;
}
+ evdev.input_event_sec = tv.tv_sec;
+ evdev.input_event_usec = tv.tv_usec;
evdev.type = le16_to_cpu(event->type);
evdev.code = le16_to_cpu(event->code);
evdev.value = le32_to_cpu(event->value);
On 32-bit systems with 64-bit time_t, input_event.time is not directly accessible. Instead, we must use input_event_sec and input_event_usec accessors to set the time values. Signed-off-by: Ariadne Conill <ariadne@dereferenced.org> --- hw/input/virtio-input-host.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)