Bug 64684 - grub does not respond to USB keyboard
grub does not respond to USB keyboard
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: grub (Show other bugs)
7.2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Jones
:
: 55246 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-09 12:25 EDT by Rich Blinne
Modified: 2007-04-18 12:42 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-04 16:05:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rich Blinne 2002-05-09 12:25:30 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)

Description of problem:
If you have just a USB keyboard and attempting to do a multi-boot.  GRUB does 
not respond.  Once GRUB loads everything is fine.  LILO responds to USB 
keyboard.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Multi-boot with GRUB on USB-only keyboard
2. Hit keys while booting
3. GRUB does not respond
	

Additional info:

This has been discussed on the grub lists and a patch has been proposed.  Since 
grub is the default loader and USB-only systems are becoming more and more 
common.  When this patch gets commited (and there is a grub release of it) you 
should pick this up as an Errata.

See the following URL:

http://mail.gnu.org/pipermail/bug-grub/2002-May/007203.html

dpates@dsdk12.net (Derrik Pates) wrote:

> Until you press at least one key on its internal keyboard, the keyboard
> plugged in via the USB port does nothing. However, if you've pressed
> anything on the USB keyboard, as soon as something's pressed on the
> internal keyboard, the buffer contents come spewing out. I think I
> mentioned in the original message that a USB-attached keyboard wouldn't
> see any response from GRUB until a key on the internal keyboard got
> pressed.

Could you try the patch I have attached here to the enable/disable
GateA20 function?

It's not a complete patch (i.e. don't check it into CVS yet!), but in
my investigation this fixes the initial problems I was seeing and I'm
curious if it takes care of your problem too.

Apply it to the CVS tree in the "stage2" directory, then build/rebuild
and it should work...

-----------------(patch for "asm.S" and "shared.h")-------------------
diff -u -r1.85 shared.h
--- shared.h	25 Mar 2002 21:43:55 -0000	1.85
+++ shared.h	7 May 2002 18:34:23 -0000
@@ -258,14 +258,18 @@
 #define VARIABLE(x) ENTRY(x)
 
 
+/* Keyboard controller defines */
 #define K_RDWR  	0x60	/* keyboard data & cmds (read/write) */
-#define K_STATUS	0x64	/* keyboard status */
+#define K_STATUS	0x64	/* keyboard status (read-only) */
 #define K_CMD		0x64	/* keybd ctlr command (write-only) */
 
 #define K_OBUF_FUL 	0x01	/* output buffer full */
 #define K_IBUF_FUL 	0x02	/* input buffer full */
 
-#define KC_CMD_WIN	0xd0	/* read  output port */
+#define KC_CMD_KBDIS	0xad	/* disable keyboard */
+#define KC_CMD_KBEN	0xae	/* enable keyboard */
+
+#define KC_CMD_ROUT	0xd0	/* read  output port */
 #define KC_CMD_WOUT	0xd1	/* write output port */
 #define KB_OUTPUT_MASK  0xdd	/* enable output buffer full interrupt
 				   enable data line
diff -u -r1.59 asm.S
--- asm.S	12 Nov 2001 06:57:29 -0000	1.59
+++ asm.S	7 May 2002 18:34:28 -0000
@@ -1694,10 +1694,24 @@
  */
 
 ENTRY(gateA20)
+	pushl	%ebp
+	movl	%esp, %ebp
 	pushl	%eax
+	pushl	%ebx
 
 	call    gloop1
 
+        /* mask PS/2 interrupts */
+        movb    $0x10, %al
+   outb    $0xa1
+        movb    $1, %al
+        outb    $0x21
+	/* disable keyboard */
+	movb	$KC_CMD_KBDIS, %al
+	outb	$K_CMD
+	call    gloop1
+
+	/* set up to write keyboard controller "output port" */
 	movb	$KC_CMD_WOUT, %al
 	outb	$K_CMD
 
@@ -1707,16 +1721,29 @@
 	jnz	gloopint1
 
 	movb	$KB_OUTPUT_MASK, %al
-	cmpb	$0, 0x8(%esp)
+	cmpb	$0, 0x8(%ebp)
 	jz	gdoit
 
 	orb	$KB_A20_ENABLE, %al
 gdoit:
+	/* write keyboard controller "output port" */
 	outb	$K_RDWR
 
 	call	gloop1
 
+	/* enable keyboard again (this also adds a bit of delay...) */
+	movb	$KC_CMD_KBEN, %al
+	outb	$K_CMD
+	call    gloop1
+        /* unmask PS/2 interrupts */
+        movb    $0, %al
+        outb    $0xa1
+        movb    $0, %al
+        outb    $0x21
+
+	popl	%ebx
 	popl	%eax
+	popl	%ebp
 	ret
 
 gloop1:
----------------------------------------------------------------------

--
    Erich Stefan Boleyn     <erich@uruk.org>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"
Comment 1 Jeremy Katz 2002-05-09 14:00:32 EDT
Already tracking the discussion :)  Once Erich has a more final patch, I'll
probably snag it and build a test package to put on people
Comment 2 Jeremy Katz 2002-05-09 14:00:39 EDT
*** Bug 55246 has been marked as a duplicate of this bug. ***
Comment 3 Jeremy Katz 2002-12-29 01:17:42 EST
grub 0.93 has changes to fix the A20 gate handling.  Packages are available in
rawhide and at http://people.redhat.com/~katzj/grub/
Comment 4 Samuel Benjamin 2004-10-05 07:45:51 EDT
This bug exists in the AS 2.1 stream and needs to be fixed as some of 
our customers are still at this level. We have test information to 
verify that  the version that ships with RHEL AS 2.1 (Grub 0.90) and 
has the problem. When using Grub 0.93, which ships with RHEL AS 3.0, 
on an AS2.1 load, the problem is resolved. 

Can the customer use Grub.93 with AS2.1 ?
Can Red Hat upgrade the version of grub which ships with AS 2.1 ?
Do you need a seperate bugzilla to address this requirement ?

- Samuel Benjamin (IBM).

Problem Description :
Installed Red Hat 2.1 AS on x445 with RSA II-EXA option installed.  
When using Grub .90, which ships with Red Hat 2.1 and there is no 
erratta listed for grub, I was unable to select the kernel in grub 
that I wanted to boot to.  I installed RH 3.0 EL AS on the same 
system and with Grub .93, you can scroll thru the list and check each 
kernel.  It appears that this is a limitation of the version of Grub 
that is in Red Hat 2.1.  I thought about trying to install the Grub 
from Red Hat 3.0 EL AS and found that it has dependencies in the 
glibc rpm.  Decided against taking the chance of crashing the OS 
since the kernel depends on glibc as well.  Will speak to PE and see 
how we want to proceed.  At this time, this appears to be a 
limitation of the revision of Grub that ships with Red Hat 2.1 AS.  
Comment 5 Bill Nottingham 2006-08-04 16:05:50 EDT
Red Hat Linux and Red Hat Powertools are currently no longer supported by Red
Hat, Inc. In an effort to clean up bugzilla, we are closing all bugs in MODIFIED
state for these products.

However, we do want to make sure that nothing important slips through the
cracks. If, in fact, these issues are not resolved in a current Fedora Core
Release (such as Fedora Core 5), please open a new issues stating so. Thanks.

Note You need to log in before you can comment on or make changes to this bug.