diff options
author | H. Peter Anvin <hpa@zytor.com> | 2014-04-20 11:23:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2014-04-20 11:23:13 -0700 |
commit | b8752b88492d8f321037ad29e56a2fdf9e798e15 (patch) | |
tree | 510ba9114ea6ac608c9675c80daa95b223d19cfc | |
parent | 61b98d65c9695200fe82570a999e29068a950d42 (diff) | |
download | syslinux-b8752b88492d8f321037ad29e56a2fdf9e798e15.tar.gz |
kbd: Use the extended keyboard state query for bios_shiftflags()
Mixing extended and non-extended keyboard functions can be a bad idea.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | core/conio.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/core/conio.c b/core/conio.c index 529673eb..427228ea 100644 --- a/core/conio.c +++ b/core/conio.c @@ -271,12 +271,27 @@ char bios_getchar(char *hi) uint8_t bios_shiftflags(void) { com32sys_t reg; + uint8_t ah, al; memset(®, 0, sizeof reg); - reg.eax.b[1] = 0x02; + reg.eax.b[1] = 0x12; __intcall(0x16, ®, ®); - - return reg.eax.b[0]; + ah = reg.eax.b[1]; + al = reg.eax.b[0]; + + /* + * According to the Interrupt List, "many machines" don't correctly + * fold the Alt state, presumably because it might be AltGr. + * Explicitly fold the Alt and Ctrl states; it fits our needs + * better. + */ + + if (ah & 0x0a) + al |= 0x08; + if (ah & 0x05) + al |= 0x04; + + return al; } __export uint8_t kbd_shiftflags(void) |