From patchwork Fri May 6 02:37:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 9028811 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 07FCD9F1D3 for ; Fri, 6 May 2016 02:38:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C0E520376 for ; Fri, 6 May 2016 02:38:49 +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 94A7020373 for ; Fri, 6 May 2016 02:38:48 +0000 (UTC) Received: from localhost ([::1]:56199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayVfA-0000bx-Qc for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 May 2016 22:38:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayVep-000071-CA for qemu-devel@nongnu.org; Thu, 05 May 2016 22:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayVeF-0004Db-5V for qemu-devel@nongnu.org; Thu, 05 May 2016 22:38:17 -0400 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]:35655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayVeD-00044A-Qe for qemu-devel@nongnu.org; Thu, 05 May 2016 22:37:47 -0400 Received: by mail-io0-x244.google.com with SMTP id u185so12769775iod.2 for ; Thu, 05 May 2016 19:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:subject:date:message-id:cc:to :mime-version; bh=G8TqKMmHfC76pDNQnLyY7do3GjChyUKMpLHdnaHc2Rk=; b=agQtn2DrLJs5XRKnlsskgDqFr6ZKHR9YvVdy+V5E9xiLPshO1gQmUd1c+VfThI63bC OnW3XTLci1hUwn8OcT+0LraMV66sRTBRxHPq5POJZfgUcwtkKTmSJhQO84FMdyqmVPCJ vOIHQ3Lw2EQNDPf5bU77+7NwVzuiqZ57QxsxlESLB4o2lvVNbcda4aykc2aVI1P3YBZv xBfEQk5taPK/f+CnfXA4JBOaDR3H8+wk17Y/Z6inMziKf80nyjAqI87n21iOLfI9TTPc cC6r3wvj+TiO0eyJekqrXjIPOZYg+fr3DIdvGSWv/5COutzosIAQ9dNf3rUymjrGmFtE 9Iiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:subject:date :message-id:cc:to:mime-version; bh=G8TqKMmHfC76pDNQnLyY7do3GjChyUKMpLHdnaHc2Rk=; b=hGz48NMlq5mnEzeyGmXZAo+rCIMH86rgbBDWr1OemmcDLskQp6K4nvrVflQi9qmD/2 BnMfvXPYGKW44R/UzpnHjA7YVrpzZWJEaw7/SMUJdeozOH5cBtUnebdZzr9cmfrI09OP fyX07wAabQUMUJfgNxq13uXy9UDW23eqXRlqgXQ9CNySJ0ULtJAydVNGDDUIOOI3mpI6 nHxFaI5Ot1UK+Mvrdkv9xbpWcMhaZ0YqzQSQj/T47xhYEUE7J98dwrBIRSdCyp9uKQSj DHOD4uIIFk36BN88FqsvgcF0lPxiwOy9qIIlzhIVPaJiZy9ZnQ+Jc4y7v6aZHdJEWerN yK6g== X-Gm-Message-State: AOPr4FWW6bMRhAxnqJ3N3QeltACqINgbMmNdv7yl/jrVL8nPcZGLzNPBNdTybtql0p7XhQ== X-Received: by 10.107.161.140 with SMTP id k134mr22111588ioe.190.1462502248268; Thu, 05 May 2016 19:37:28 -0700 (PDT) Received: from [192.168.0.5] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id i14sm5565815iod.34.2016.05.05.19.37.26 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 May 2016 19:37:27 -0700 (PDT) From: Programmingkid Date: Thu, 5 May 2016 22:37:26 -0400 Message-Id: <2C310CE8-A8DE-4383-BC90-C4589FCE9D79@gmail.com> To: Peter Maydell , Gerd Hoffmann Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::244 Subject: [Qemu-devel] [PATCH v3 3/5] adb.c: correct several key assignments 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: qemu-devel qemu-devel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY, UPPERCASE_50_75 autolearn=ham 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 original pc_to_adb_keycode mapping did have several keys that were incorrectly mapped. This patch fixes these mappings. Signed-off-by: John Arbuckle --- hw/input/adb.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/hw/input/adb.c b/hw/input/adb.c index 715642f..6d4f4dc 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,19 +194,21 @@ 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, [Q_KEY_CODE_ALT] = ADB_KEY_LEFT_OPTION, [Q_KEY_CODE_ALT_R] = ADB_KEY_RIGHT_OPTION, - [Q_KEY_CODE_ALTGR] = 0, + [Q_KEY_CODE_ALTGR] = ADB_KEY_RIGHT_OPTION, [Q_KEY_CODE_CTRL] = ADB_KEY_LEFT_CONTROL, [Q_KEY_CODE_CTRL_R] = ADB_KEY_RIGHT_CONTROL, [Q_KEY_CODE_META_L] = ADB_KEY_LEFT_COMMAND, /* ADB_KEY_RIGHT_COMMAND works as right super in Linux */ /* Use ADB_KEY_LEFT_COMMAND for Mac OS compatibility */ - [Q_KEY_CODE_META_R] = 0x7e, + [Q_KEY_CODE_META_R] = ADB_KEY_LEFT_COMMAND, [Q_KEY_CODE_SPC] = ADB_KEY_SPACEBAR, [Q_KEY_CODE_ESC] = ADB_KEY_ESC, @@ -272,13 +277,13 @@ int qcode_to_adb_keycode[] = { [Q_KEY_CODE_F10] = ADB_KEY_F10, [Q_KEY_CODE_F11] = ADB_KEY_F11, [Q_KEY_CODE_F12] = ADB_KEY_F12, - [Q_KEY_CODE_PRINT] = 0, - [Q_KEY_CODE_SYSRQ] = 0, + [Q_KEY_CODE_PRINT] = ADB_KEY_F13, + [Q_KEY_CODE_SYSRQ] = ADB_KEY_F13, [Q_KEY_CODE_SCROLL_LOCK] = ADB_KEY_F14, - [Q_KEY_CODE_PAUSE] = 0, + [Q_KEY_CODE_PAUSE] = ADB_KEY_F15, [Q_KEY_CODE_NUM_LOCK] = ADB_KEY_KP_CLEAR, - [Q_KEY_CODE_KP_EQUALS] = 0, + [Q_KEY_CODE_KP_EQUALS] = ADB_KEY_KP_EQUAL, [Q_KEY_CODE_KP_DIVIDE] = ADB_KEY_KP_DIVIDE, [Q_KEY_CODE_KP_MULTIPLY] = ADB_KEY_KP_MULTIPLY, [Q_KEY_CODE_KP_SUBTRACT] = ADB_KEY_KP_SUBTRACT, @@ -301,27 +306,13 @@ int qcode_to_adb_keycode[] = { [Q_KEY_CODE_LEFT] = ADB_KEY_LEFT, [Q_KEY_CODE_RIGHT] = ADB_KEY_RIGHT, - [Q_KEY_CODE_HELP] = 0, + [Q_KEY_CODE_HELP] = ADB_KEY_HELP, [Q_KEY_CODE_INSERT] = ADB_KEY_HELP, [Q_KEY_CODE_DELETE] = ADB_KEY_FORWARD_DELETE, [Q_KEY_CODE_HOME] = ADB_KEY_HOME, [Q_KEY_CODE_END] = ADB_KEY_END, [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, }; static void adb_kbd_put_keycode(void *opaque, int keycode)