[PATCH] kbdmux(4), atkbd(4) and ddb(4)

Maksim Yevmenkin maksim.yevmenkin at savvis.net
Thu Apr 27 23:43:30 UTC 2006


dear hackers,

there were many complains about atkbd(4) not working in ddb(4) with 
kbdmux(4) enabled.

i had a minute of free time and looked into this. it seems to me that 
atkbd(4) is not dealing properly with "polled" mode. after looking at 
the code, i came up with the attached patch.

i did some very brief testing and the patch works for me. atkbd(4) now 
works in ddb(4) and single user mode with kbdmux(4) enabled.

the patch is rather ugly (imo), because it assumes that something will 
call "poll" method repeatedly (which seems like we do it). also, ukbd(4) 
has somewhat similar code.

could someone (with atkbd(4), syscons(4) and ddb(4) fu) please review it 
and tell me if its ok to commit.

also, i would appreciate if someone would perform more extensive testing 
to see if there are any regressions.

thanks,
max
-------------- next part --------------
--- atkbd.c.orig	Thu Apr 27 16:29:26 2006
+++ atkbd.c	Thu Apr 27 16:30:13 2006
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/dev/atkbdc/atkbd.c,v 1.47 2005/06/10 20:56:37 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/atkbdc/atkbd.c,v 1.47 2005/06/10 20:56:37 marius Exp $");
 
 #include "opt_kbd.h"
 #include "opt_atkbd.h"
@@ -1023,6 +1023,15 @@
 		++state->ks_polling;
 	else
 		--state->ks_polling;
+
+	if (state->ks_polling) {
+		if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) {
+			(*kbdsw[kbd->kb_index]->lock)(kbd, FALSE);
+			if ((*kbdsw[kbd->kb_index]->check_char)(kbd))
+				(*kbdsw[kbd->kb_index]->intr)(kbd, NULL);
+		}
+	}
+
 	splx(s);
 	return 0;
 }


More information about the freebsd-current mailing list