From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abmvI-0008LD-7L for qemu-devel@nongnu.org; Fri, 04 Mar 2016 05:25:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abmvH-0007BF-Bg for qemu-devel@nongnu.org; Fri, 04 Mar 2016 05:25:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abmvH-0007At-7I for qemu-devel@nongnu.org; Fri, 04 Mar 2016 05:25:27 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id D800DC09FAB2 for ; Fri, 4 Mar 2016 10:25:26 +0000 (UTC) From: Gerd Hoffmann Date: Fri, 4 Mar 2016 11:25:16 +0100 Message-Id: <1457087116-4379-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1457087116-4379-1-git-send-email-kraxel@redhat.com> References: <1457087116-4379-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] input-linux: add switch to enable auto-repeat events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Enable with "-input-linux /dev/input/${device},repeat=on". Signed-off-by: Gerd Hoffmann --- ui/input-linux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/input-linux.c b/ui/input-linux.c index ad43963..0bc0405 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -132,6 +132,7 @@ typedef struct InputLinux InputLinux; struct InputLinux { const char *evdev; int fd; + bool repeat; bool grab_request; bool grab_active; bool grab_all; @@ -188,7 +189,7 @@ static void input_linux_event_keyboard(void *opaque) switch (event.type) { case EV_KEY: - if (event.value > 1) { + if (event.value > 2 || (event.value > 1 && !il->repeat)) { /* * ignore autorepeat + unknown key events * 0 == up, 1 == down, 2 == autorepeat, other == undefined @@ -316,6 +317,7 @@ int input_linux_init(void *opaque, QemuOpts *opts, Error **errp) il->evdev = qemu_opt_get(opts, "evdev"); il->grab_all = qemu_opt_get_bool(opts, "grab-all", false); + il->repeat = qemu_opt_get_bool(opts, "repeat", false); if (!il->evdev) { error_setg(errp, "no input device specified"); @@ -374,6 +376,9 @@ static QemuOptsList qemu_input_linux_opts = { },{ .name = "grab-all", .type = QEMU_OPT_BOOL, + },{ + .name = "repeat", + .type = QEMU_OPT_BOOL, }, { /* end of list */ } }, -- 1.8.3.1