From patchwork Thu Aug 18 02:27:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 9286729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C26660574 for ; Thu, 18 Aug 2016 02:35:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B84628FA1 for ; Thu, 18 Aug 2016 02:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 105A028FB9; Thu, 18 Aug 2016 02:35:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 9EA0628FBB for ; Thu, 18 Aug 2016 02:35:18 +0000 (UTC) Received: from localhost ([::1]:50380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baDAr-0003I9-9N for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Aug 2016 22:35:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baD4p-0007ed-2J for qemu-devel@nongnu.org; Wed, 17 Aug 2016 22:29:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baD4j-0004aY-WB for qemu-devel@nongnu.org; Wed, 17 Aug 2016 22:29:02 -0400 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]:35602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baD4Q-0004S5-DA; Wed, 17 Aug 2016 22:28:38 -0400 Received: by mail-io0-x243.google.com with SMTP id q83so1413018iod.2; Wed, 17 Aug 2016 19:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lxLF99i+EeENd4sxBWom/PeJBF0EQpDtDnCNQiDSP5o=; b=Q2rlgzJD2M5UA7344dOur4EgnkaY8D1/lborDeGWoIvc65jtoH6hqUb2aPhxTOfFyj dUSktf1HVGaX2ZyxhTuUC+u0svSfIdZFUNSknDPzVuVXeJdgANt6nKqPSk6WEVJ75z98 3cr60tvngOZeZeEajg6hanWWIx2O0nIBWEmPIKl1ykJ8jvNIJwnBssNOOqvrWFwarRkA TkGIdC/iSfhs9hSh0Fr6lLpxQb34JccyXutPE7pDsj8+gqduYa7UfnFatAn5std3JGKb l2fcYgBgV7njlsTz9UfVQRApzet3p/Q2s0XCVp4RuHg07kKxQhdKa2s0FmojUzN9IwRl 871A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lxLF99i+EeENd4sxBWom/PeJBF0EQpDtDnCNQiDSP5o=; b=LSiSSZJc+oGnp3KI9bsg0Q4pLhX8tWTxKkGgq2khAQtKzH8L2izonZPr3ylVf2ny0c NZz2dic570ZcvRFxuxrTMUE8X+Yfu2XaBa21LD6cYOAJ5cZjEjUfxtANOeNHFWkJEltC 5Vclttk+i3CHvhf11ZpqqfKFRXXHkA4vJhJ3glxDF/wubn5Lwbeq4xam6h8vMsIaDFJY Nbj0pO38au+Jz/i/FvIy8NIY7XEc6NF34D0W4utCZxjfUHh4xZV81pjOS6vYtiVSt0w8 TqO4Me5fyS9qRcpQdshSB3G/Lzo427LzwrvXckyU5PeDFT51l+CUDN1YS64LJboxEQg9 ZVmA== X-Gm-Message-State: AEkoousznLGee99w9BShwOp+x6LdlT4uST6DiKcXD9ruSzAqM0XP5+nO63zUN/e6Gwbxlg== X-Received: by 10.107.172.67 with SMTP id v64mr387771ioe.164.1471487318011; Wed, 17 Aug 2016 19:28:38 -0700 (PDT) Received: from localhost.localdomain (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id n23sm169896ioe.18.2016.08.17.19.28.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Aug 2016 19:28:37 -0700 (PDT) From: John Arbuckle To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, qemu-devel@nongnu.org Date: Wed, 17 Aug 2016 22:27:50 -0400 Message-Id: <1471487270-1490-5-git-send-email-programmingkidx@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1471487270-1490-1-git-send-email-programmingkidx@gmail.com> References: <1471487270-1490-1-git-send-email-programmingkidx@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::243 Subject: [Qemu-devel] [PATCH v5 4/4] adb.c: prevent NO_KEY value from going to guest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The NO_KEY value should not be sent to the guest. This patch drops that value. Signed-off-by: John Arbuckle --- v5 changes: Added ADB_DPRINTF() call. v4 changes: Added NO_KEY related code to this patch. Added removal of "= 0" code near end of qcode_to_adb_keycode. hw/input/adb.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/input/adb.c b/hw/input/adb.c index 12c6333..3d39368 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -62,6 +62,9 @@ do { printf("ADB: " fmt , ## __VA_ARGS__); } while (0) /* error codes */ #define ADB_RET_NOTPRESENT (-2) +/* The adb keyboard doesn't have every key imaginable */ +#define NO_KEY 0xff + static void adb_device_reset(ADBDevice *d) { qdev_reset_all(DEVICE(d)); @@ -191,6 +194,8 @@ typedef struct ADBKeyboardClass { } ADBKeyboardClass; int qcode_to_adb_keycode[] = { + /* Make sure future additions are automatically set to NO_KEY */ + [0 ... 0xff] = NO_KEY, [Q_KEY_CODE_SHIFT] = ADB_KEY_LEFT_SHIFT, [Q_KEY_CODE_SHIFT_R] = ADB_KEY_RIGHT_SHIFT, @@ -306,19 +311,6 @@ int qcode_to_adb_keycode[] = { [Q_KEY_CODE_PGUP] = ADB_KEY_PAGE_UP, [Q_KEY_CODE_PGDN] = ADB_KEY_PAGE_DOWN, - [Q_KEY_CODE_LESS] = 0xa, - [Q_KEY_CODE_STOP] = 0, - [Q_KEY_CODE_AGAIN] = 0, - [Q_KEY_CODE_PROPS] = 0, - [Q_KEY_CODE_UNDO] = 0, - [Q_KEY_CODE_FRONT] = 0, - [Q_KEY_CODE_COPY] = 0, - [Q_KEY_CODE_OPEN] = 0, - [Q_KEY_CODE_PASTE] = 0, - [Q_KEY_CODE_FIND] = 0, - [Q_KEY_CODE_CUT] = 0, - [Q_KEY_CODE_LF] = 0, - [Q_KEY_CODE_COMPOSE] = 0, [Q_KEY_CODE_POWER] = ADB_KEY_POWER }; @@ -446,7 +438,10 @@ static void adb_keyboard_event(DeviceState *dev, QemuConsole *src, return; } keycode = qcode_to_adb_keycode[qcode]; - + if (keycode == NO_KEY) { /* We don't want to send this to the guest */ + ADB_DPRINTF("Ignoring NO_KEY\n"); + return; + } if (evt->u.key.data->down == false) { /* if key release event */ keycode = keycode | 0x80; /* create keyboard break code */ }