From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqMyi-0001WF-IZ for qemu-devel@nongnu.org; Wed, 13 Apr 2016 11:45:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqMya-0004nU-65 for qemu-devel@nongnu.org; Wed, 13 Apr 2016 11:45:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqMya-0004n5-1H for qemu-devel@nongnu.org; Wed, 13 Apr 2016 11:45:08 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5BDA81F07 for ; Wed, 13 Apr 2016 15:45:07 +0000 (UTC) From: Gerd Hoffmann Date: Wed, 13 Apr 2016 17:44:59 +0200 Message-Id: <1460562303-17079-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1460562303-17079-1-git-send-email-kraxel@redhat.com> References: <1460562303-17079-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL v2 5/9] virtio-input: implement pass-through evdev writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ladi Prosek , Gerd Hoffmann , "Michael S. Tsirkin" From: Ladi Prosek 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 Message-id: 1459511146-12060-1-git-send-email-lprosek@redhat.com Signed-off-by: Gerd Hoffmann --- hw/input/virtio-input-host.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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) -- 1.8.3.1