summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-11-12 05:33:04 -0800
committerSimon Glass <sjg@chromium.org>2015-11-19 20:13:42 -0700
commite5f330c482034b84f4c7ae2b8f3465f3c9863fb7 (patch)
tree6c7abe4378b0aa130eee14c71038c06684eec12b /drivers
parent377a06964370bd887ec15f77f3e4e179c27fe8b9 (diff)
downloadblackbird-obmc-uboot-e5f330c482034b84f4c7ae2b8f3465f3c9863fb7.tar.gz
blackbird-obmc-uboot-e5f330c482034b84f4c7ae2b8f3465f3c9863fb7.zip
input: Ban digit numbers if 'Num Lock' is not on
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 526769692b..a39db3cc9c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -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 {
OpenPOWER on IntegriCloud