]> git.sur5r.net Git - u-boot/blobdiff - drivers/input/input.c
spi: xilinx: Read reg base address from DTS file
[u-boot] / drivers / input / input.c
index 526769692be8550b5b62f9b60ab3c3d35c450ecc..29620a9e2793b5d318bafc9d67d77ef734698ef8 100644 (file)
@@ -1,13 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Translate key codes into ASCII
  *
  * Copyright (c) 2011 The Chromium OS Authors.
  * (C) Copyright 2004 DENX Software Engineering, Wolfgang Denk, wd@denx.de
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <console.h>
 #include <dm.h>
 #include <errno.h>
 #include <stdio_dev.h>
@@ -82,6 +82,9 @@ static unsigned char kbd_ctrl_xlate[] = {
        '\r', 0xff, '/',  '*',
 };
 
+/*
+ * German keymap. Special letters are mapped according to code page 437.
+ */
 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 */
@@ -123,7 +126,7 @@ static unsigned char kbd_shift_xlate_german[] = {
 };
 
 static unsigned char kbd_right_alt_xlate_german[] = {
-       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
+       0xff, 0xff, 0xff, 0xfd, 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 */
@@ -479,6 +482,12 @@ static int input_keycodes_to_ascii(struct input_config *config,
                        if ((config->flags & FLAG_CAPS_LOCK) &&
                            ch >= 'a' && ch <= 'z')
                                ch -= 'a' - 'A';
+                       /* ban digit numbers if 'Num Lock' is not on */
+                       if (!(config->flags & FLAG_NUM_LOCK)) {
+                               if (key >= KEY_KP7 && key <= KEY_KPDOT &&
+                                   key != KEY_KPMINUS && key != KEY_KPPLUS)
+                                       ch = 0xff;
+                       }
                        if (ch_count < max_chars && ch != 0xff)
                                output_ch[ch_count++] = (uchar)ch;
                } else {
@@ -645,7 +654,7 @@ int input_stdio_register(struct stdio_dev *dev)
        error = stdio_register(dev);
 
        /* check if this is the standard input device */
-       if (!error && strcmp(getenv("stdin"), dev->name) == 0) {
+       if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
                /* reassign the console */
                if (OVERWRITE_CONSOLE ||
                                console_assign(stdin, dev->name))