Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2009 17:17:20 -0700
From:      Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   [patch] prevent atkbd(4) from calling callback in polled mode
Message-ID:  <bb4a86c70904151717j1b92f4f6t26244b1ab698bf97@mail.gmail.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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

[-- Attachment #2 --]
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,
help

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