From patchwork Fri Apr 1 11:45:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladi Prosek X-Patchwork-Id: 8723291 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E145E9F38C for ; Fri, 1 Apr 2016 11:46:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47FBE203B6 for ; Fri, 1 Apr 2016 11:46:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8877E203AD for ; Fri, 1 Apr 2016 11:46:03 +0000 (UTC) Received: from localhost ([::1]:43703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxWd-0007cp-19 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Apr 2016 07:46:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxWV-0007cj-Hh for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:45:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alxWR-0007YL-Kt for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:45:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxWR-0007YG-Fd for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:45:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 1E2BDC03BD5C for ; Fri, 1 Apr 2016 11:45:51 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (dhcp-1-127.brq.redhat.com [10.34.1.127]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u31BjniR031933; Fri, 1 Apr 2016 07:45:50 -0400 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Fri, 1 Apr 2016 13:45:46 +0200 Message-Id: <1459511146-12060-1-git-send-email-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Ladi Prosek , kraxel@redhat.com Subject: [Qemu-devel] [PATCH v2] virtio-input: implement pass-through evdev writes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- v1 -> v2 - dropped the queue of pending writes 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 36856d6..62185d5 100644 --- a/hw/input/virtio-input-host.c +++ b/hw/input/virtio-input-host.c @@ -145,6 +145,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, @@ -164,6 +186,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)