Skip to content

Commit

Permalink
input: Ban digit numbers if 'Num Lock' is not on
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Simon Glass <[email protected]>
  • Loading branch information
lbmeng authored and sjg20 committed Nov 20, 2015
1 parent 377a069 commit e5f330c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e5f330c

Please sign in to comment.