[patch] prevent atkbd(4) from calling callback in polled mode

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Thu Apr 16 00:17:21 UTC 2009


hello,

would anyone object to the small attached atkbd(4) patch? the idea is
to basically prevent atkbd(4) interrupt handler from calling keyboard
callback function when polled mode is enabled.

i would really like to hear from people who is using kbdmux(4) on smp
systems and having problems with duplicated/missing characters while
using keyboard at mountroot, geli, etc. prompts. basically, when low
level console input functions (cngetc(), gets(), etc.) are used _and_
interrupts are enabled.

thanks,
max
-------------- next part --------------
Index: atkbd.c
===================================================================
--- atkbd.c	(revision 191012)
+++ atkbd.c	(working copy)
@@ -476,7 +476,7 @@
 static int
 atkbd_intr(keyboard_t *kbd, void *arg)
 {
-	atkbd_state_t *state;
+	atkbd_state_t *state = (atkbd_state_t *)kbd->kb_data;
 	int delay[2];
 	int c;
 
@@ -485,7 +485,6 @@
 		 * The keyboard was not detected before;
 		 * it must have been reconnected!
 		 */
-		state = (atkbd_state_t *)kbd->kb_data;
 		init_keyboard(state->kbdc, &kbd->kb_type,
 			      kbd->kb_config);
 		KBD_FOUND_DEVICE(kbd);
@@ -496,6 +495,9 @@
 		atkbd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
 	}
 
+	if (state->ks_polling)
+		return 0;
+
 	if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) {
 		/* let the callback function to process the input */
 		(*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT,


More information about the freebsd-current mailing list