From patchwork Thu Sep 22 06:37:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 673157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3sfnQX3FbLz9s4n for ; Thu, 22 Sep 2016 16:58:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=cyhkqHTS; dkim-atps=neutral Received: from localhost ([::1]:56151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmxxy-0002L2-2n for incoming@patchwork.ozlabs.org; Thu, 22 Sep 2016 02:58:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmxeO-0007V3-8g for qemu-devel@nongnu.org; Thu, 22 Sep 2016 02:38:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmxeM-0006K8-3b for qemu-devel@nongnu.org; Thu, 22 Sep 2016 02:38:27 -0400 Received: from ozlabs.org ([103.22.144.67]:50479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmxeL-0006Hr-Nm; Thu, 22 Sep 2016 02:38:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3sfmyX51MCz9t2G; Thu, 22 Sep 2016 16:37:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1474526276; bh=GSaojKO1g/SIoRI29e4b0VW0NAXEHrnDRYX7pLkjgR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cyhkqHTSW5bKsYRheM7KMS3IzB9zuKYMXDn2o5IIK2uL4o0uCT9UgfZgT+ReMXz+D yXpOmlieuRUOV2lNayMZMLdoqpeO0eSxov9neKXq1pOnj8Pr+KBbbUcE0lcUH/fnKt HnzZIvISt3pWNIrBALzXpku0gIw/dy49vVKyNFgk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 22 Sep 2016 16:37:14 +1000 Message-Id: <1474526262-27011-17-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474526262-27011-1-git-send-email-david@gibson.dropbear.id.au> References: <1474526262-27011-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 16/44] 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 , David Gibson , qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: John Arbuckle The NO_KEY value should not be sent to the guest. This patch drops that value. Signed-off-by: John Arbuckle Signed-off-by: David Gibson --- 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 */ }