[U-Boot] [PATCH v2 2/5] usb: kbd: implement special keys

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Aug 10 09:24:16 UTC 2019


Provide support for F1-F12, Insert, Delete, Home, End, Page Up, Page Down.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v2:
	no change
---
 common/usb_kbd.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 232d278e13..c9ac7a9e4c 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -232,6 +232,60 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode,
 		debug("%c", keycode);

 	switch (scancode) {
+	case 0x3a:					/* F1 */
+		usb_kbd_put_sequence(data, "\eOP");
+		break;
+	case 0x3b:					/* F2 */
+		usb_kbd_put_sequence(data, "\eOQ");
+		break;
+	case 0x3c:					/* F3 */
+		usb_kbd_put_sequence(data, "\eOR");
+		break;
+	case 0x3d:					/* F4 */
+		usb_kbd_put_sequence(data, "\eOS");
+		break;
+	case 0x3e:					/* F5 */
+		usb_kbd_put_sequence(data, "\e[15~");
+		break;
+	case 0x3f:					/* F6 */
+		usb_kbd_put_sequence(data, "\e[17~");
+		break;
+	case 0x40:					/* F7 */
+		usb_kbd_put_sequence(data, "\e[18~");
+		break;
+	case 0x41:					/* F8 */
+		usb_kbd_put_sequence(data, "\e[19~");
+		break;
+	case 0x42:					/* F9 */
+		usb_kbd_put_sequence(data, "\e[20~");
+		break;
+	case 0x43:					/* F10 */
+		usb_kbd_put_sequence(data, "\e[21~");
+		break;
+	case 0x44:					/* F11 */
+		usb_kbd_put_sequence(data, "\e[23~");
+		break;
+	case 0x45:					/* F12 */
+		usb_kbd_put_sequence(data, "\e[24~");
+		break;
+	case 0x49:					/* INSERT */
+		usb_kbd_put_sequence(data, "\e[2~");
+		break;
+	case 0x4a:					/* HOME */
+		usb_kbd_put_sequence(data, "\e[H");
+		break;
+	case 0x4b:					/* PAGE UP */
+		usb_kbd_put_sequence(data, "\e[5~");
+		break;
+	case 0x4c:					/* DELETE */
+		usb_kbd_put_sequence(data, "\e[3~");
+		break;
+	case 0x4d:					/* END */
+		usb_kbd_put_sequence(data, "\e[F");
+		break;
+	case 0x4e:					/* PAGE DOWN */
+		usb_kbd_put_sequence(data, "\e[6~");
+		break;
 	case 0x4f:					/* Right arrow key */
 		usb_kbd_put_sequence(data, "\e[C");
 		break;
--
2.20.1



More information about the U-Boot mailing list