Skip to content
Snippets Groups Projects
Commit e5f330c4 authored by Bin Meng's avatar Bin Meng Committed by Simon Glass
Browse files

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: default avatarBin Meng <bmeng.cn@gmail.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
parent 377a0696
No related branches found
No related tags found
No related merge requests found
...@@ -479,6 +479,12 @@ static int input_keycodes_to_ascii(struct input_config *config, ...@@ -479,6 +479,12 @@ static int input_keycodes_to_ascii(struct input_config *config,
if ((config->flags & FLAG_CAPS_LOCK) && if ((config->flags & FLAG_CAPS_LOCK) &&
ch >= 'a' && ch <= 'z') ch >= 'a' && ch <= 'z')
ch -= 'a' - 'A'; 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) if (ch_count < max_chars && ch != 0xff)
output_ch[ch_count++] = (uchar)ch; output_ch[ch_count++] = (uchar)ch;
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment