[syslinux:master] bios: Use int 0x16, ah= 0x02 to probe for shift flags

syslinux-bot for H. Peter Anvin hpa at zytor.com
Thu Apr 17 21:57:04 PDT 2014


Commit-ID:  fdad168405fd97471f5086dee84b2ebe14e314d3
Gitweb:     http://www.syslinux.org/commit/fdad168405fd97471f5086dee84b2ebe14e314d3
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 17 Apr 2014 20:38:11 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 17 Apr 2014 20:38:11 -0700

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 <hpa at zytor.com>

---
 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 a3061ed..fc1376e 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(&reg, 0, sizeof reg);
+    reg.eax.b[1] = 0x02;
+    __intcall(0x16, &reg, &reg);
+
+    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 42c12a3..ce8716e 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:


More information about the Syslinux-commits mailing list