From nobody Tue Dec 16 11:04:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505220154966540.899975715934; Tue, 12 Sep 2017 05:42:34 -0700 (PDT) Received: from localhost ([::1]:35590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drkWQ-0004Xn-20 for importer@patchew.org; Tue, 12 Sep 2017 08:42:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drkS7-0000jK-2n for qemu-devel@nongnu.org; Tue, 12 Sep 2017 08:38:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drkS3-0003St-WA for qemu-devel@nongnu.org; Tue, 12 Sep 2017 08:38:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36980) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drkS3-0003Se-Ny for qemu-devel@nongnu.org; Tue, 12 Sep 2017 08:38:03 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8D4B81DED for ; Tue, 12 Sep 2017 12:38:02 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA0BC77D65; Tue, 12 Sep 2017 12:38:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8D4B81DED Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=berrange@redhat.com From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Tue, 12 Sep 2017 13:37:40 +0100 Message-Id: <20170912123744.14730-9-berrange@redhat.com> In-Reply-To: <20170912123744.14730-1-berrange@redhat.com> References: <20170912123744.14730-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 12 Sep 2017 12:38:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 08/12] char: convert the escc device to keycodemapdb 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Replace the qcode_to_keycode table with automatically generated tables. Missing entries in qcode_to_keycode now fixed: - Q_KEY_CODE_KP_COMMA -> 0x2d Signed-off-by: Daniel P. Berrange --- hw/char/escc.c | 126 +++----------------------------------------------= ---- include/ui/input.h | 3 ++ ui/Makefile.objs | 1 + ui/input-keymap.c | 1 + 4 files changed, 10 insertions(+), 121 deletions(-) diff --git a/hw/char/escc.c b/hw/char/escc.c index 3ab831a6a7..449bf2fc63 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -717,126 +717,6 @@ MemoryRegion *escc_init(hwaddr base, qemu_irq irqA, q= emu_irq irqB, return &d->mmio; } =20 -static const uint8_t qcode_to_keycode[Q_KEY_CODE__MAX] =3D { - [Q_KEY_CODE_SHIFT] =3D 99, - [Q_KEY_CODE_SHIFT_R] =3D 110, - [Q_KEY_CODE_ALT] =3D 19, - [Q_KEY_CODE_ALT_R] =3D 13, - [Q_KEY_CODE_CTRL] =3D 76, - [Q_KEY_CODE_CTRL_R] =3D 76, - [Q_KEY_CODE_ESC] =3D 29, - [Q_KEY_CODE_1] =3D 30, - [Q_KEY_CODE_2] =3D 31, - [Q_KEY_CODE_3] =3D 32, - [Q_KEY_CODE_4] =3D 33, - [Q_KEY_CODE_5] =3D 34, - [Q_KEY_CODE_6] =3D 35, - [Q_KEY_CODE_7] =3D 36, - [Q_KEY_CODE_8] =3D 37, - [Q_KEY_CODE_9] =3D 38, - [Q_KEY_CODE_0] =3D 39, - [Q_KEY_CODE_MINUS] =3D 40, - [Q_KEY_CODE_EQUAL] =3D 41, - [Q_KEY_CODE_BACKSPACE] =3D 43, - [Q_KEY_CODE_TAB] =3D 53, - [Q_KEY_CODE_Q] =3D 54, - [Q_KEY_CODE_W] =3D 55, - [Q_KEY_CODE_E] =3D 56, - [Q_KEY_CODE_R] =3D 57, - [Q_KEY_CODE_T] =3D 58, - [Q_KEY_CODE_Y] =3D 59, - [Q_KEY_CODE_U] =3D 60, - [Q_KEY_CODE_I] =3D 61, - [Q_KEY_CODE_O] =3D 62, - [Q_KEY_CODE_P] =3D 63, - [Q_KEY_CODE_BRACKET_LEFT] =3D 64, - [Q_KEY_CODE_BRACKET_RIGHT] =3D 65, - [Q_KEY_CODE_RET] =3D 89, - [Q_KEY_CODE_A] =3D 77, - [Q_KEY_CODE_S] =3D 78, - [Q_KEY_CODE_D] =3D 79, - [Q_KEY_CODE_F] =3D 80, - [Q_KEY_CODE_G] =3D 81, - [Q_KEY_CODE_H] =3D 82, - [Q_KEY_CODE_J] =3D 83, - [Q_KEY_CODE_K] =3D 84, - [Q_KEY_CODE_L] =3D 85, - [Q_KEY_CODE_SEMICOLON] =3D 86, - [Q_KEY_CODE_APOSTROPHE] =3D 87, - [Q_KEY_CODE_GRAVE_ACCENT] =3D 42, - [Q_KEY_CODE_BACKSLASH] =3D 88, - [Q_KEY_CODE_Z] =3D 100, - [Q_KEY_CODE_X] =3D 101, - [Q_KEY_CODE_C] =3D 102, - [Q_KEY_CODE_V] =3D 103, - [Q_KEY_CODE_B] =3D 104, - [Q_KEY_CODE_N] =3D 105, - [Q_KEY_CODE_M] =3D 106, - [Q_KEY_CODE_COMMA] =3D 107, - [Q_KEY_CODE_DOT] =3D 108, - [Q_KEY_CODE_SLASH] =3D 109, - [Q_KEY_CODE_ASTERISK] =3D 47, - [Q_KEY_CODE_SPC] =3D 121, - [Q_KEY_CODE_CAPS_LOCK] =3D 119, - [Q_KEY_CODE_F1] =3D 5, - [Q_KEY_CODE_F2] =3D 6, - [Q_KEY_CODE_F3] =3D 8, - [Q_KEY_CODE_F4] =3D 10, - [Q_KEY_CODE_F5] =3D 12, - [Q_KEY_CODE_F6] =3D 14, - [Q_KEY_CODE_F7] =3D 16, - [Q_KEY_CODE_F8] =3D 17, - [Q_KEY_CODE_F9] =3D 18, - [Q_KEY_CODE_F10] =3D 7, - [Q_KEY_CODE_NUM_LOCK] =3D 98, - [Q_KEY_CODE_SCROLL_LOCK] =3D 23, - [Q_KEY_CODE_KP_DIVIDE] =3D 46, - [Q_KEY_CODE_KP_MULTIPLY] =3D 47, - [Q_KEY_CODE_KP_SUBTRACT] =3D 71, - [Q_KEY_CODE_KP_ADD] =3D 125, - [Q_KEY_CODE_KP_ENTER] =3D 90, - [Q_KEY_CODE_KP_DECIMAL] =3D 50, - [Q_KEY_CODE_KP_0] =3D 94, - [Q_KEY_CODE_KP_1] =3D 112, - [Q_KEY_CODE_KP_2] =3D 113, - [Q_KEY_CODE_KP_3] =3D 114, - [Q_KEY_CODE_KP_4] =3D 91, - [Q_KEY_CODE_KP_5] =3D 92, - [Q_KEY_CODE_KP_6] =3D 93, - [Q_KEY_CODE_KP_7] =3D 68, - [Q_KEY_CODE_KP_8] =3D 69, - [Q_KEY_CODE_KP_9] =3D 70, - [Q_KEY_CODE_LESS] =3D 124, - [Q_KEY_CODE_F11] =3D 9, - [Q_KEY_CODE_F12] =3D 11, - [Q_KEY_CODE_HOME] =3D 52, - [Q_KEY_CODE_PGUP] =3D 96, - [Q_KEY_CODE_PGDN] =3D 123, - [Q_KEY_CODE_END] =3D 74, - [Q_KEY_CODE_LEFT] =3D 24, - [Q_KEY_CODE_UP] =3D 20, - [Q_KEY_CODE_DOWN] =3D 27, - [Q_KEY_CODE_RIGHT] =3D 28, - [Q_KEY_CODE_INSERT] =3D 44, - [Q_KEY_CODE_DELETE] =3D 66, - [Q_KEY_CODE_STOP] =3D 1, - [Q_KEY_CODE_AGAIN] =3D 3, - [Q_KEY_CODE_PROPS] =3D 25, - [Q_KEY_CODE_UNDO] =3D 26, - [Q_KEY_CODE_FRONT] =3D 49, - [Q_KEY_CODE_COPY] =3D 51, - [Q_KEY_CODE_OPEN] =3D 72, - [Q_KEY_CODE_PASTE] =3D 73, - [Q_KEY_CODE_FIND] =3D 95, - [Q_KEY_CODE_CUT] =3D 97, - [Q_KEY_CODE_LF] =3D 111, - [Q_KEY_CODE_HELP] =3D 118, - [Q_KEY_CODE_META_L] =3D 120, - [Q_KEY_CODE_META_R] =3D 122, - [Q_KEY_CODE_COMPOSE] =3D 67, - [Q_KEY_CODE_PRINT] =3D 22, - [Q_KEY_CODE_SYSRQ] =3D 21, -}; =20 static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) @@ -879,7 +759,11 @@ static void sunkbd_handle_event(DeviceState *dev, Qemu= Console *src, } } =20 - keycode =3D qcode_to_keycode[qcode]; + if (qcode > qemu_input_map_qcode_to_sun_len) { + return; + } + + keycode =3D qemu_input_map_qcode_to_sun[qcode]; if (!key->down) { keycode |=3D 0x80; } diff --git a/include/ui/input.h b/include/ui/input.h index 4aa5655a0b..4ba7340b7b 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -89,6 +89,9 @@ extern const guint16 qemu_input_map_qcode_to_linux[]; extern const guint qemu_input_map_qcode_to_qnum_len; extern const guint16 qemu_input_map_qcode_to_qnum[]; =20 +extern const guint qemu_input_map_qcode_to_sun_len; +extern const guint16 qemu_input_map_qcode_to_sun[]; + extern const guint qemu_input_map_qnum_to_qcode_len; extern const guint16 qemu_input_map_qnum_to_qcode[]; =20 diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 6846636f39..3cd1122ea9 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -61,6 +61,7 @@ KEYCODEMAP_FILES =3D \ ui/input-keymap-qcode-to-atset3.c \ ui/input-keymap-qcode-to-linux.c \ ui/input-keymap-qcode-to-qnum.c \ + ui/input-keymap-qcode-to-sun.c \ ui/input-keymap-qnum-to-qcode.c \ $(NULL) =20 diff --git a/ui/input-keymap.c b/ui/input-keymap.c index 5d97a38c42..1b53cb4d0a 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -12,6 +12,7 @@ #include "ui/input-keymap-qcode-to-atset3.c" #include "ui/input-keymap-qcode-to-linux.c" #include "ui/input-keymap-qcode-to-qnum.c" +#include "ui/input-keymap-qcode-to-sun.c" #include "ui/input-keymap-qnum-to-qcode.c" =20 int qemu_input_linux_to_qcode(unsigned int lnx) --=20 2.13.5