]> git.sur5r.net Git - u-boot/commitdiff
input: Ban digit numbers if 'Num Lock' is not on
authorBin Meng <bmeng.cn@gmail.com>
Thu, 12 Nov 2015 13:33:04 +0000 (05:33 -0800)
committerSimon Glass <sjg@chromium.org>
Fri, 20 Nov 2015 03:13:42 +0000 (20:13 -0700)
When 'Num Lock' is not on, we should not send these digit numbers
(0-9 and dot) to the output buffer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/input/input.c

index 526769692be8550b5b62f9b60ab3c3d35c450ecc..a39db3cc9c0ba67a55d3d641d61211b8d4347078 100644 (file)
@@ -479,6 +479,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 {