]> git.sur5r.net Git - u-boot/commitdiff
input: Handle caps lock
authorSimon Glass <sjg@chromium.org>
Wed, 11 Nov 2015 17:05:39 +0000 (10:05 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 20 Nov 2015 03:13:41 +0000 (20:13 -0700)
When caps lock is enabled we should convert lower case to upper case. Add
this to the input key processing so that caps lock works correctly.

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

index a64bd87e19c6e966ccebd676035beef30ae95876..5de8d9d005d8b5ee0709bf5eb8b9a297a594fcf8 100644 (file)
@@ -452,16 +452,19 @@ static int input_keycodes_to_ascii(struct input_config *config,
        /* Start conversion by looking for the first new keycode (by same). */
        for (i = same; i < num_keycodes; i++) {
                int key = keycode[i];
-               int ch = (key < table->num_entries) ? table->xlate[key] : 0xff;
+               int ch;
 
                /*
                 * For a normal key (with an ASCII value), add it; otherwise
                 * translate special key to escape sequence if possible.
                 */
-               if (ch != 0xff) {
-                       if (ch_count < max_chars)
-                               output_ch[ch_count] = (uchar)ch;
-                       ch_count++;
+               if (key < table->num_entries) {
+                       ch = table->xlate[key];
+                       if ((config->flags & FLAG_CAPS_LOCK) &&
+                           ch >= 'a' && ch <= 'z')
+                               ch -= 'a' - 'A';
+                       if (ch_count < max_chars && ch != 0xff)
+                               output_ch[ch_count++] = (uchar)ch;
                } else {
                        ch_count += input_keycode_to_ansi364(config, key,
                                                output_ch, max_chars);