From patchwork Wed Sep 9 04:32:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515695 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id EFDC9140497 for ; Wed, 9 Sep 2015 14:42:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=VsuFbH8D; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6BD734B7FE; Wed, 9 Sep 2015 06:42:48 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tg2gEIFed3qd; Wed, 9 Sep 2015 06:42:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 027554B810; Wed, 9 Sep 2015 06:42:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E06CA4B796 for ; Wed, 9 Sep 2015 06:42:18 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6ysCIvQOTeCe for ; Wed, 9 Sep 2015 06:42:18 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ig0-f174.google.com (mail-ig0-f174.google.com [209.85.213.174]) by theia.denx.de (Postfix) with ESMTPS id 67FA64B71C for ; Wed, 9 Sep 2015 06:42:14 +0200 (CEST) Received: by igbkq10 with SMTP id kq10so95787483igb.0 for ; Tue, 08 Sep 2015 21:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=a/Tii9xOqjNgi0tVSpb0griZd0+i/m2Ei7lKarwbLYA=; b=VsuFbH8D9BfQswoP7RY8CDN9B2F5MwyOsXOjYHUIsDfMuuFU3tEC04AtxwJ7M1CIO4 knJ5D/Ggp33y+mRunN3Izcf1ziRC++EdgEdSz0mjSWOlQPU4FkoKVruwTnxnxRapxJmD koYl3Dq5aS6GO8rHtfLZvDUiekVAMBl8H7BKxw29gHi4htIqLAEpColO5mZzraeLCJRw ew59Bnsr9ZQg9sOqE7jEHMQafylAODACmbT+Kn2RS67BeRwVny/y7WsRuV4V8ezNkGJ6 GGQ4dS+/VjCmvkjDXkNSlJpFg6D/5KHRYEIBuVu6GSmy1LwpTUuAfB0xysndQAVPlzqg FY1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=a/Tii9xOqjNgi0tVSpb0griZd0+i/m2Ei7lKarwbLYA=; b=HHfxqcwXj0GP7Yn5iRe2wvQYRg2W4faN/cyqV5dLXhabY75tRNXXSBpedYie0Kl0eO x61kVig0XuxftqueU4kDAwCgjdU26pYZYpVZjU+L+Yr7HkPNs2C3H2eOib8P6r3TM04T B3DBb43JmnRK0tLrn9+WQDqyy0freBs7lUqqy/btl+5RPhQVnkuQm1u+ba0qW1rLKflv PhxdaWSDxAiNo9/4wND+AUkkVU9/O/WlNDPfraNoYIrzrfyhfYQ/03GP1ZzczFQE/jYq baXjR+QD3Iif/y4PqYxdEuJ5O+SI1U8OXL7Z1iaCYAvmBCxuv0Zm7loeYzZasma6ZslC FlEg== X-Gm-Message-State: ALoCoQnh8hFdn1DNaaGrP17icGrvn3YMUHzNkVYp6hQooCNh42r7gDUvGPNJKa9yHz5KLxcoTOX4 X-Received: by 10.50.85.6 with SMTP id d6mr46528198igz.26.1441773733575; Tue, 08 Sep 2015 21:42:13 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:29c2:aacf:f3d3:bb56]) by smtp.gmail.com with ESMTPSA id m18sm3811941ioi.44.2015.09.08.21.42.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 21:42:12 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 059ED2218E3; Tue, 8 Sep 2015 22:33:19 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 8 Sep 2015 22:32:41 -0600 Message-Id: <1441773171-4575-19-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d In-Reply-To: <1441773171-4575-1-git-send-email-sjg@chromium.org> References: <1441773171-4575-1-git-send-email-sjg@chromium.org> Cc: Marek Vasut , Tom Rini , Jeroen Hofstee Subject: [U-Boot] [PATCH 18/28] input: Support the German keymap X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add support for the German keymap, taken from i8042.c. This can be selected when the input library it initialised. Signed-off-by: Simon Glass --- board/kosagi/novena/novena.c | 2 +- drivers/input/cros_ec_keyb.c | 2 +- drivers/input/input.c | 82 ++++++++++++++++++++++++++++++++++++++++---- drivers/input/tegra-kbc.c | 2 +- include/input.h | 3 +- 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c index 48cbb0f..0b61365 100644 --- a/board/kosagi/novena/novena.c +++ b/board/kosagi/novena/novena.c @@ -88,7 +88,7 @@ int drv_keyboard_init(void) debug("%s: Cannot set up input\n", __func__); return -1; } - input_add_tables(&button_input); + input_add_tables(&button_input, false); button_input.read_keys = novena_gpio_button_read_keys; error = input_stdio_register(&dev); diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c index fe5caea..9bc4555 100644 --- a/drivers/input/cros_ec_keyb.c +++ b/drivers/input/cros_ec_keyb.c @@ -211,7 +211,7 @@ static int cros_ec_kbd_probe(struct udevice *dev) priv->input = input; input->dev = dev; - input_add_tables(input); + input_add_tables(input, false); input->read_keys = cros_ec_kbc_check; strcpy(sdev->name, "cros-ec-keyb"); diff --git a/drivers/input/input.c b/drivers/input/input.c index c488f3a..a54449e 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -78,6 +78,60 @@ static unsigned char kbd_ctrl_xlate[] = { '\r', 0xff, '/', '*', }; +static const uchar kbd_plain_xlate_german[] = { + 0xff, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 00-07 */ + '7', '8', '9', '0', 0xe1, '\'', 0x08, '\t', /* scan 08-0F */ + 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', /* scan 10-17 */ + 'o', 'p', 0x81, '+', '\r', 0xff, 'a', 's', /* scan 18-1F */ + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0x94, /* scan 20-27 */ + 0x84, '^', 0xff, '#', 'y', 'x', 'c', 'v', /* scan 28-2F */ + 'b', 'n', 'm', ',', '.', '-', 0xff, '*', /* scan 30-37 */ + ' ', ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '7', /* scan 40-47 */ + '8', '9', '-', '4', '5', '6', '+', '1', /* scan 48-4F */ + '2', '3', '0', ',', 0xff, 0xff, '<', 0xff, /* scan 50-57 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */ + '\r', 0xff, '/', '*', +}; + +static unsigned char kbd_shift_xlate_german[] = { + 0xff, 0x1b, '!', '"', 0x15, '$', '%', '&', /* scan 00-07 */ + '/', '(', ')', '=', '?', '`', 0x08, '\t', /* scan 08-0F */ + 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', /* scan 10-17 */ + 'O', 'P', 0x9a, '*', '\r', 0xff, 'A', 'S', /* scan 18-1F */ + 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0x99, /* scan 20-27 */ + 0x8e, 0xf8, 0xff, '\'', 'Y', 'X', 'C', 'V', /* scan 28-2F */ + 'B', 'N', 'M', ';', ':', '_', 0xff, '*', /* scan 30-37 */ + ' ', ' ', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '7', /* scan 40-47 */ + '8', '9', '-', '4', '5', '6', '+', '1', /* scan 48-4F */ + '2', '3', '0', ',', 0xff, 0xff, '>', 0xff, /* scan 50-57 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */ + '\r', 0xff, '/', '*', +}; + +static unsigned char kbd_right_alt_xlate_german[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */ + '{', '[', ']', '}', '\\', 0xff, 0xff, 0xff, /* scan 08-0F */ + '@', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10-17 */ + 0xff, 0xff, 0xff, '~', 0xff, 0xff, 0xff, 0xff, /* scan 18-1F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 20-27 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 28-2F */ + 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 30-37 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 40-47 */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 48-4F */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '|', 0xff, /* scan 50-57 */ +}; + /* * Scan key code to ANSI 3.64 escape sequence table. This table is * incomplete in that it does not include all possible extra keys. @@ -500,14 +554,28 @@ void input_allow_repeats(struct input_config *config, bool allow_repeats) config->allow_repeats = allow_repeats; } -int input_add_tables(struct input_config *config) +int input_add_tables(struct input_config *config, bool german) { - input_add_table(config, -1, -1, - kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)); - input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT, - kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)); - input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL, - kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate)); + if (german) { + input_add_table(config, -1, -1, + kbd_plain_xlate_german, + ARRAY_SIZE(kbd_plain_xlate_german)); + input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT, + kbd_shift_xlate_german, + ARRAY_SIZE(kbd_shift_xlate_german)); + input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL, + kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate)); + } else { + input_add_table(config, -1, -1, + kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)); + input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT, + kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)); + input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL, + kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate)); + input_add_table(config, -1, KEY_RIGHTALT, + kbd_right_alt_xlate_german, + ARRAY_SIZE(kbd_right_alt_xlate_german)); + } return 0; } diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c index a7137f1..951cbb4 100644 --- a/drivers/input/tegra-kbc.c +++ b/drivers/input/tegra-kbc.c @@ -326,7 +326,7 @@ static int tegra_kbd_probe(struct udevice *dev) priv->input = input; input->dev = dev; input->read_keys = tegra_kbc_check; - input_add_tables(input); + input_add_tables(input, false); strcpy(sdev->name, "tegra-kbc"); ret = input_stdio_register(sdev); if (ret) { diff --git a/include/input.h b/include/input.h index e56f500..c1af259 100644 --- a/include/input.h +++ b/include/input.h @@ -167,9 +167,10 @@ void input_allow_repeats(struct input_config *config, bool allow_repeats); * This must be called after input_init() or keycode decoding will not work. * * @param config Input state + * @param german true to use German keyboard layout, false for US * @return 0 if ok, -1 on error */ -int input_add_tables(struct input_config *config); +int input_add_tables(struct input_config *config, bool german); /** * Set up the input handler with basic key maps.