From owner-freebsd-hackers Sun Sep 10 22:50:41 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id WAA09289 for hackers-outgoing; Sun, 10 Sep 1995 22:50:41 -0700 Received: from frig.mt.cs.keio.ac.jp (frig.mt.cs.keio.ac.jp [131.113.32.7]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id WAA09275 for ; Sun, 10 Sep 1995 22:50:37 -0700 Received: (from hosokawa@localhost) by frig.mt.cs.keio.ac.jp (8.6.12+2.4W/3.4Wbeta3) id OAA06548; Mon, 11 Sep 1995 14:50:25 +0900 Date: Mon, 11 Sep 1995 14:50:25 +0900 Message-Id: <199509110550.OAA06548@frig.mt.cs.keio.ac.jp> To: freebsd-hackers@FreeBSD.org Subject: Are DELAY()'s of keyboard driver insufficient?? From: hosokawa@mt.cs.keio.ac.jp (HOSOKAWA Tatsumi) X-Mailer: mnews [version 1.18PL3] 1994-08/01(Mon) Sender: hackers-owner@FreeBSD.org Precedence: bulk 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;