fix: phy: marvell: cp110: fix the KR/SFI line 4 selector
[oweals/u-boot.git] / drivers / input / input.c
index e02e2643c9f2a385d22e7cc2435d07f624840638..011667fedda4269a26dedfa8b1f83a9486086519 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <console.h>
 #include <dm.h>
 #include <errno.h>
 #include <stdio_dev.h>
@@ -19,9 +20,9 @@
 
 enum {
        /* These correspond to the lights on the keyboard */
-       FLAG_NUM_LOCK           = 1 << 0,
-       FLAG_CAPS_LOCK          = 1 << 1,
-       FLAG_SCROLL_LOCK        = 1 << 2,
+       FLAG_SCROLL_LOCK        = 1 << 0,
+       FLAG_NUM_LOCK           = 1 << 1,
+       FLAG_CAPS_LOCK          = 1 << 2,
 
        /* Special flag ORed with key code to indicate release */
        KEY_RELEASE             = 1 << 15,
@@ -479,6 +480,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 {