From: Bin Meng Date: Thu, 12 Nov 2015 05:33:04 -0800 Subject: [U-Boot] [PATCH 4/6] input: Ban digit numbers if 'Num Lock' is not on In-Reply-To: <1447335186-27731-1-git-send-email-bmeng.cn@gmail.com> References: <1447335186-27731-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1447335186-27731-4-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- drivers/input/input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 5c3fad9..23afd06 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -474,6 +474,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 { -- 1.8.2.1