@@ -51,7 +51,7 @@ kbd_init(void)
, x + FIELD_SIZEOF(struct bios_data_area_s, kbd_buf));
}
-static u8
+u8
enqueue_key(u16 keycode)
{
u16 buffer_start = GET_BDA(kbd_buf_start_offset);
@@ -376,6 +376,21 @@ static struct scaninfo {
{ 0x8600, 0x8800, 0x8a00, 0x8c00 }, /* F12 */
};
+u16 ascii_to_keycode(u8 ascii)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(scan_to_keycode); i++) {
+ if ((GET_GLOBAL(scan_to_keycode[i].normal) & 0xff) == ascii)
+ return GET_GLOBAL(scan_to_keycode[i].normal);
+ if ((GET_GLOBAL(scan_to_keycode[i].shift) & 0xff) == ascii)
+ return GET_GLOBAL(scan_to_keycode[i].shift);
+ if ((GET_GLOBAL(scan_to_keycode[i].control) & 0xff) == ascii)
+ return GET_GLOBAL(scan_to_keycode[i].control);
+ }
+ return 0;
+}
+
// Handle a ps2 style scancode read from the keyboard.
static void
__process_key(u8 scancode)
@@ -185,6 +185,8 @@ int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
void kbd_init(void);
void handle_15c2(struct bregs *regs);
void process_key(u8 key);
+u8 enqueue_key(u16 keycode);
+u16 ascii_to_keycode(u8 ascii);
// misc.c
extern int HaveRunPost;
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- src/kbd.c | 17 ++++++++++++++++- src/util.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-)