From fdad168405fd97471f5086dee84b2ebe14e314d3 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 17 Apr 2014 20:38:11 -0700 Subject: bios: Use int 0x16, ah=0x02 to probe for shift flags At least one USB keyboard BIOS has been reported to not properly handle the keyboard flags in memory. See if actually using INT 16h works better. Signed-off-by: H. Peter Anvin --- com32/menu/menumain.c | 14 +++++++++++--- mbr/adjust.h | 8 ++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c index a3061ede..fc1376eb 100644 --- a/com32/menu/menumain.c +++ b/com32/menu/menumain.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * * * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved - * Copyright 2009-2011 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 @@ -611,9 +611,17 @@ static const char *edit_cmdline(const char *input, int top) static inline int shift_is_held(void) { - uint8_t shift_bits = *(uint8_t *) 0x417; +#ifdef __FIRMWARE_BIOS__ + com32sys_t reg; - return !!(shift_bits & 0x5d); /* Caps/Scroll/Alt/Shift */ + memset(®, 0, sizeof reg); + reg.eax.b[1] = 0x02; + __intcall(0x16, ®, ®); + + return !!(reg.eax.b[0] & 0x5d); /* Caps/Scroll/Alt/Shift */ +#else + return 0; /* Need to implement this */ +#endif } static void print_timeout_message(int tol, int row, const char *msg) diff --git a/mbr/adjust.h b/mbr/adjust.h index 42c12a35..ce8716eb 100644 --- a/mbr/adjust.h +++ b/mbr/adjust.h @@ -1,6 +1,6 @@ /* -*- asm -*- ----------------------------------------------------------- * - * Copyright 2009 Intel Corporation; author: H. Peter Anvin + * Copyright 2009-2014 Intel Corporation; author: H. Peter Anvin * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -36,7 +36,11 @@ #ifdef CTRL_80 .macro ADJUST_DRIVE - testb $0x04, BIOS_kbdflags + pusha + movb $0x02, %ah + int $0x16 + testb $0x04, %al + popa jz 1f movb $0x80, %dl 1: -- cgit v1.2.1