summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-04-15 07:30:07 -0400
committerTom Rini <trini@konsulko.com>2019-04-15 07:30:07 -0400
commit939803e1303f4329896a566883593325c6d75057 (patch)
tree3246d2d14bb8c3390a50aef6ba1cb9a40d45abf6 /common
parent216800acf1fbf9f498455bf3c92d4513d9a4c681 (diff)
parent7b64a70a3a0113f9cd5356b3260d4740edb03265 (diff)
downloadu-boot-939803e1303f4329896a566883593325c6d75057.tar.gz
u-boot-939803e1303f4329896a566883593325c6d75057.tar.bz2
u-boot-939803e1303f4329896a566883593325c6d75057.zip
Merge tag 'video-for-2019.07-rc1' of git://git.denx.de/u-boot-video
- optional backlight PWM polarity config via polarity cell - bug fix for ASCII characters > 127 - ANSI sequence handling extensions (implement clear line, reverse video and relative cursor movement commands) - preparation for doing character set translations - left/right and up/down arrow keys translation to ANSI control sequences for cursor movement to fix selection with an USB keyboard in bootmenu - CONFIG_SYS_WHITE_ON_BLACK font scheme configuration for sunxi boards
Diffstat (limited to 'common')
-rw-r--r--common/usb_kbd.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 020f0d4117..cc99c6be07 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -145,6 +145,12 @@ static void usb_kbd_put_queue(struct usb_kbd_pdata *data, char c)
data->usb_kbd_buffer[data->usb_in_pointer] = c;
}
+static void usb_kbd_put_sequence(struct usb_kbd_pdata *data, char *s)
+{
+ for (; *s; s++)
+ usb_kbd_put_queue(data, *s);
+}
+
/*
* Set the LEDs. Since this is used in the irq routine, the control job is
* issued with a timeout of 0. This means, that the job is queued without
@@ -235,9 +241,25 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode,
}
/* Report keycode if any */
- if (keycode) {
+ if (keycode)
debug("%c", keycode);
+
+ switch (keycode) {
+ case 0x0e: /* Down arrow key */
+ usb_kbd_put_sequence(data, "\e[B");
+ break;
+ case 0x10: /* Up arrow key */
+ usb_kbd_put_sequence(data, "\e[A");
+ break;
+ case 0x06: /* Right arrow key */
+ usb_kbd_put_sequence(data, "\e[C");
+ break;
+ case 0x02: /* Left arrow key */
+ usb_kbd_put_sequence(data, "\e[D");
+ break;
+ default:
usb_kbd_put_queue(data, keycode);
+ break;
}
return 0;