summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-08-09 06:13:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-08-09 06:13:31 +0000
commit9627dd4e1c203f5e539a4acc0f089f62896eefff (patch)
tree59637227fc8cc11b45af60340ad826130c2000f0 /sys
parent0679cc48be413867f5cb01bdf4166bd53c71dd29 (diff)
Wait for ACK's back from the kbd controller when setting typematic rate.
Fixes a hang when starting X windows on pc's with picky kbd controllers.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_kbd.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
index ccab226fc36..2ce7f6353f5 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcvt_kbd.c,v 1.17 1998/07/12 18:56:06 weingart Exp $ */
+/* $OpenBSD: pcvt_kbd.c,v 1.18 1998/08/09 06:13:30 millert Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
@@ -302,11 +302,30 @@ update_led(void)
static void
settpmrate(int rate)
{
+ int opri, response1, response2;
+
+ opri = spltty();
tpmrate = rate & 0x7f;
- if(kbd_cmd(KEYB_C_TYPEM) != 0)
+ if (kbd_cmd(KEYB_C_TYPEM) != 0) {
printf("Keyboard TYPEMATIC command timeout\n");
- else if(kbd_cmd(tpmrate) != 0)
+ splx(opri);
+ return;
+ }
+ response1 = kbd_response(); /* wait for ACK */
+
+ if (kbd_cmd(tpmrate) != 0) {
printf("Keyboard TYPEMATIC data timeout\n");
+ splx(opri);
+ return;
+ }
+ response2 = kbd_response(); /* wait for ACK */
+
+ if (response1 != KEYB_R_ACK || response2 != KEYB_R_ACK) {
+ printf(
+ "Keyboard TYPEMATIC command not ACKed (responses %#x %#x)\n",
+ response1, response2);
+ }
+ splx(opri);
}
/*---------------------------------------------------------------------------*