bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: USB keyboard problem elucidated?


From: erich
Subject: Re: USB keyboard problem elucidated?
Date: Tue, 07 May 2002 11:47:09 -0700

address@hidden (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     <address@hidden>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]