Message ID | 1447261548-14304-4-git-send-email-sjg@chromium.org |
---|---|
State | Accepted |
Delegated to: | Simon Glass |
Headers | show |
On Thu, Nov 12, 2015 at 1:05 AM, Simon Glass <sjg@chromium.org> wrote: > 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> > --- > > Changes in v3: None > Changes in v2: None > > drivers/input/input.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/input/input.c b/drivers/input/input.c > index 7513226..a8a15c9 100644 > --- a/drivers/input/input.c > +++ b/drivers/input/input.c > @@ -453,16 +453,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); > -- Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Applied to u-boot-dm.
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7513226..a8a15c9 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -453,16 +453,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);
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> --- Changes in v3: None Changes in v2: None drivers/input/input.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)