aboutsummaryrefslogtreecommitdiff
path: root/hw/input
diff options
context:
space:
mode:
authorLadi Prosek <lprosek@redhat.com>2016-04-01 13:45:46 +0200
committerGerd Hoffmann <kraxel@redhat.com>2016-04-13 15:52:28 +0200
commit1a782629f668875955f4f08ac8f11de752d71298 (patch)
tree141421a494fefd9ba1e62e4182b3ca579de1411e /hw/input
parent848c4d4480561154ada54851ba411aea3977c771 (diff)
downloadqemu-1a782629f668875955f4f08ac8f11de752d71298.zip
qemu-1a782629f668875955f4f08ac8f11de752d71298.tar.gz
qemu-1a782629f668875955f4f08ac8f11de752d71298.tar.bz2
virtio-input: implement pass-through evdev writes
The write path for pass-through devices, commonly used for controlling keyboard LEDs via EV_LED, was not implemented. This commit adds the necessary plumbing to connect the status virtio queue to the host evdev file descriptor. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Message-id: 1459511146-12060-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/input')
-rw-r--r--hw/input/virtio-input-host.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c
index 97b7dd6..96124f4 100644
--- a/hw/input/virtio-input-host.c
+++ b/hw/input/virtio-input-host.c
@@ -146,6 +146,28 @@ static void virtio_input_host_unrealize(DeviceState *dev, Error **errp)
}
}
+static void virtio_input_host_handle_status(VirtIOInput *vinput,
+ virtio_input_event *event)
+{
+ VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput);
+ struct input_event evdev;
+ int rc;
+
+ if (gettimeofday(&evdev.time, NULL)) {
+ perror("virtio_input_host_handle_status: gettimeofday");
+ return;
+ }
+
+ evdev.type = le16_to_cpu(event->type);
+ evdev.code = le16_to_cpu(event->code);
+ evdev.value = le32_to_cpu(event->value);
+
+ rc = write(vih->fd, &evdev, sizeof(evdev));
+ if (rc == -1) {
+ perror("virtio_input_host_handle_status: write");
+ }
+}
+
static const VMStateDescription vmstate_virtio_input_host = {
.name = "virtio-input-host",
.unmigratable = 1,
@@ -165,6 +187,7 @@ static void virtio_input_host_class_init(ObjectClass *klass, void *data)
dc->props = virtio_input_host_properties;
vic->realize = virtio_input_host_realize;
vic->unrealize = virtio_input_host_unrealize;
+ vic->handle_status = virtio_input_host_handle_status;
}
static void virtio_input_host_init(Object *obj)