Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 1995 14:50:25 +0900
From:      hosokawa@mt.cs.keio.ac.jp (HOSOKAWA Tatsumi)
To:        freebsd-hackers@FreeBSD.org
Subject:   Are DELAY()'s of keyboard driver insufficient??
Message-ID:  <199509110550.OAA06548@frig.mt.cs.keio.ac.jp>

next in thread | raw e-mail | index | archive | help
Hi!

I remember that somebody reported on this mailing list or
comp.unix.freebsd.misc about the starnge behavior of the keyboard.
The problem is that the keyboard hangs up when we're using X on some
machines.

In fact, I have the same problem on my desktop machine (P5-133, 16M,
No-brand 84 Keyboard, S3-964) and another machine on computing center
of our University (P5-90, 48M, No-brand 101 Keyboard, S3-928).  When
I'm using XFree86 and AccelX on this machine, the keyboard suddenly
hangs up.  The keyboard comes back when I kill the X server by
destroying the login window with the mouse.  This problem happens when
I using modifier keys frequently, especially on using emacs.

Someone followed to the article, and wrote that this problem may be
the misconfiguration of the window manager, but I'm using the same
".twmrc" and ".fvwmrc" on other FreeBSD machines (DX4-75, 20M, Laptop,
C&T65535 and P5-90, 32M, No-brand 84 Keyboard, Mach64) and it works
fine.  Moreover, this problem happens both on XFree86 and AccelX.  So,
this problem is not the miscofiguration of window manager and/or the
bugs of the X servers.

On Japanese newsgroup about FreeBSD (fj.os.bsd.freebsd), I read that
this problem can be the timing problems of the keyboard driver.  So, I
increased the "DELAY()"'s of syscons.c ten times, then this problem
never happens (four times is insufficient on my machine).  I want the
following patch to be applied ASAP on the -current and the -stable.

P.S. I also think that the same problem should happen on psm drivers.

--
	HOSOKAWA, Tatsumi              E-mail: hosokawa@mt.cs.keio.ac.jp
	  WWW homepage: http://www.mt.cs.keio.ac.jp/person/hosokawa.html
	Department of Computer Science, Keio University, Yokohama, Japan

--- syscons.c.orig	Tue May 30 17:03:13 1995
+++ syscons.c	Thu Sep  7 06:12:34 1995
@@ -156,7 +156,7 @@
 
     /* flush any noise in the buffer */
     while (inb(KB_STAT) & KB_BUF_FULL) {
-	DELAY(10);
+	DELAY(100);
 	(void) inb(KB_DATA);
     }
 
@@ -165,7 +165,7 @@
 	kbd_wait();
 	outb(KB_DATA, KB_RESET);
 	for (i=0; i<100000; i++) {
-	    DELAY(10);
+	    DELAY(100);
 	    val = inb(KB_DATA);
 	    if (val == KB_ACK || val == KB_ECHO)
 		goto gotres;
@@ -178,9 +178,9 @@
 	printf("scprobe: keyboard won't accept RESET command\n");
     else {
 gotack:
-	DELAY(10);
-	while ((inb(KB_STAT) & KB_BUF_FULL) == 0) DELAY(10);
-	DELAY(10);
+	DELAY(100);
+	while ((inb(KB_STAT) & KB_BUF_FULL) == 0) DELAY(100);
+	DELAY(100);
 	val = inb(KB_DATA);
 	if (val == KB_ACK)
 	    goto gotack;
@@ -2625,7 +2625,7 @@
 	while (i--) {
 	    if (inb(KB_STAT) & KB_BUF_FULL) {
 		int val;
-		DELAY(10);
+		DELAY(100);
 		val = inb(KB_DATA);
 		if (val == KB_ACK)
 		    return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509110550.OAA06548>