Bug 64684 - grub does not respond to USB keyboard
Summary: grub does not respond to USB keyboard
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: grub
Version: 7.2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Jones
QA Contact:
URL:
Whiteboard:
: 55246 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-09 16:25 UTC by Rich Blinne
Modified: 2007-04-18 16:42 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-08-04 20:05:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Rich Blinne 2002-05-09 16:25:30 UTC
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 (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>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"

Comment 1 Jeremy Katz 2002-05-09 18:00:32 UTC
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 18:00:39 UTC
*** Bug 55246 has been marked as a duplicate of this bug. ***

Comment 3 Jeremy Katz 2002-12-29 06:17:42 UTC
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 11:45:51 UTC
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 20:05:50 UTC
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.