Switch get_raw_keystroke() to return ax instead of ah, so it returns
both scan code and ascii code of the key pressed.

Add get_keystroke_full() function which passes up ax to the caller.

The get_keystroke() function continues to return the scancode only like
it did before.  It is a thin wrapper around get_keystroke_full() now
though.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 src/util.h |  1 +
 src/boot.c | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/util.h b/src/util.h
index 9c06850353a4..e2afc80c425a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -36,6 +36,7 @@ int bootprio_find_pci_rom(struct pci_device *pci, int 
instance);
 int bootprio_find_named_rom(const char *name, int instance);
 struct usbdevice_s;
 int bootprio_find_usb(struct usbdevice_s *usbdev, int lun);
+int get_keystroke_full(int msec);
 int get_keystroke(int msec);
 
 // bootsplash.c
diff --git a/src/boot.c b/src/boot.c
index 9f82f3ca0c3e..013d407a6449 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -441,12 +441,13 @@ get_raw_keystroke(void)
     memset(&br, 0, sizeof(br));
     br.flags = F_IF;
     call16_int(0x16, &br);
-    return br.ah;
+    return br.ax;
 }
 
 // Read a keystroke - waiting up to 'msec' milliseconds.
+// returns both scancode and ascii code.
 int
-get_keystroke(int msec)
+get_keystroke_full(int msec)
 {
     u32 end = irqtimer_calc(msec);
     for (;;) {
@@ -458,6 +459,17 @@ get_keystroke(int msec)
     }
 }
 
+// Read a keystroke - waiting up to 'msec' milliseconds.
+// returns scancode only.
+int
+get_keystroke(int msec)
+{
+    int keystroke = get_keystroke_full(msec);
+
+    if (keystroke < 0)
+        return keystroke;
+    return keystroke >> 8;
+}
 
 /****************************************************************
  * Boot menu and BCV execution
-- 
2.18.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to