> Hello,
> 
> I decided to try XFree86 4.1.0, but it won't start; the X server hangs
> during keyboard initialization. The following backtrace is from a
> recent CVS version:
> 
> (gdb) bt
> #0  0x80a8fc0 in inb (port=100)
>     at ../../../../../../programs/Xserver/hw/xfree86/common/compiler.h:1135
> #1  0x80a8dff in xf86SetKbdRepeat (rad=32 ' ') at lnx_io.c:197
> #2  0x808fb91 in xf86InitKBD (init=1) at xf86Io.c:246
> #3  0x808fd8c in xf86KbdProc (pKeyboard=0x8372518, what=0) at xf86Io.c:338
> #4  0x80cc2eb in InitAndStartDevices () at devices.c:169
> #5  0x80e3728 in main (argc=1, argv=0xbffffccc, envp=0xbffffcd4) at main.c:403
> 
> It hangs in this loop:
> 
>   while ((inb(0x64) & 2) == 2); /* wait */
> 
> I guess that line is trying to read something from an AT keyboard, but
> I don't have one... 4.0.3 did not have this problem.
> 
> Just putting a 'return' before the infinite loop fixes the problem,
> and I can also use my USB keyboard. But I don't believe this is a good
> fix... :)
> 
> What's a good solution?
> 
> Regards,
> 
> Pontus
> 


(This issue may have been discussed before, but I
wasn't able to find it in a quick scan of my archives.
My apologies if I duplicate any information previously
discussed.)

What type of hardware are you using?

This problem can arise if you are talking to a USB 
keyboard on a system without a PS/2 controller.

The attached patch should address this.  Unfortunately,
it's not based on the latest snapshot of that
file, so someone could have already applied a similar
fix, or the line numbers could be slightly off.
It essentially adds a countdown to the 'while' loops in
xf86SetKbdRepeat() so that it doesn't spin forever.

Let me know if this works.

-paul

---------------------------------------------------------------------------

--- xc-orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c       Fri Aug  3 
16:12:41 2001
+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c    Mon Aug  6 12:08:54 
+2001
@@ -34,6 +34,8 @@
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
 
+#define KBC_TIMEOUT 250        /* Timeout in ms for sending to keyboard controller */
+
 void
 xf86SoundKbdBell(int loudness, int pitch, int duration)
 {
@@ -140,6 +142,7 @@
 #endif
 {
   int i;
+  int timeout;
   int         value = 0x7f;    /* Maximum delay with slowest rate */
 
 #ifdef __sparc__
@@ -194,9 +197,14 @@
       break;
     }
 
-  while ((inb(0x64) & 2) == 2); /* wait */
+  timeout = KBC_TIMEOUT;
+  while (((inb(0x64) & 2) == 2) && --timeout)
+       usleep(1000); /* wait */
+
   outb(0x60, 0xf3);             /* set typematic rate */
-  while ((inb(0x64) & 2) == 2); /* wait */
+  while (((inb(0x64) & 2) == 2) && --timeout)
+       usleep(1000); /* wait */
+
   usleep(10000);
   outb(0x60, value);
 
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to