aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-04-20 11:17:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-04-20 11:19:25 -0700
commit61b98d65c9695200fe82570a999e29068a950d42 (patch)
tree6c8a073706b98c2becc0a43a7c3321d398e927c1 /core
parentfdad168405fd97471f5086dee84b2ebe14e314d3 (diff)
downloadsyslinux-61b98d65c9695200fe82570a999e29068a950d42.tar.gz
syslinux-61b98d65c9695200fe82570a999e29068a950d42.tar.xz
syslinux-61b98d65c9695200fe82570a999e29068a950d42.zip
kbd: Make getting the keyboard shift state a firmware method
Getting the keyboard shift state is a firmware method. It is unfortunately unclear if it is even possible on EFI. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core')
-rw-r--r--core/bios.c2
-rw-r--r--core/conio.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/core/bios.c b/core/bios.c
index 328c729a..7fb37fec 100644
--- a/core/bios.c
+++ b/core/bios.c
@@ -148,10 +148,12 @@ struct output_ops bios_output_ops = {
extern char bios_getchar(char *);
extern int bios_pollchar(void);
+extern uint8_t bios_shiftflags(void);
struct input_ops bios_input_ops = {
.getchar = bios_getchar,
.pollchar = bios_pollchar,
+ .shiftflags = bios_shiftflags,
};
static void bios_get_serial_console_info(uint16_t *iobase, uint16_t *divisor,
diff --git a/core/conio.c b/core/conio.c
index 35ef0b4e..529673eb 100644
--- a/core/conio.c
+++ b/core/conio.c
@@ -2,7 +2,7 @@
* -----------------------------------------------------------------------
*
* Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2014 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -268,6 +268,25 @@ char bios_getchar(char *hi)
return data;
}
+uint8_t bios_shiftflags(void)
+{
+ com32sys_t reg;
+
+ memset(&reg, 0, sizeof reg);
+ reg.eax.b[1] = 0x02;
+ __intcall(0x16, &reg, &reg);
+
+ return reg.eax.b[0];
+}
+
+__export uint8_t kbd_shiftflags(void)
+{
+ if (firmware->i_ops->shiftflags)
+ return firmware->i_ops->shiftflags();
+ else
+ return 0; /* Unavailable on this firmware */
+}
+
/*
* getchar: Read a character from keyboard or serial port
*/