USB keyboard problem

plasma plasmaball at pchome.com.tw
Sat Sep 27 00:30:10 PDT 2003


On Sat, Sep 27, 2003 at 02:16:07AM +0800, plasma wrote:
> The problem is here:
> 
> Sep 27 01:37:28 plasmanb /kernel: before old: 22 44 
> Sep 27 01:37:28 plasmanb /kernel: before new: 44 
> Sep 27 01:37:28 plasmanb /kernel: no: 2, nn: 0
> Sep 27 01:37:28 plasmanb /kernel: 0x416 (1046) released
> Sep 27 01:37:28 plasmanb /kernel: 0x42c (1068) released

Ok, I finally found out what's really going on.  I added another debug
patch, and everything is clear:

Sep 27 14:30:24 plasmanb /kernel: before old: 12 22 0 0 0 0 (6) 
Sep 27 14:30:24 plasmanb /kernel: before new: 0 22 0 0 0 0 (6) 

That's it!  The 0's is not guaranteed to be the end of data.  With
this knowledge, the fix is obvious:

[[[
--- /usr/src/sys/dev/usb/ukbd.c.orig	Mon Mar 31 08:31:35 2003
+++ /usr/src/sys/dev/usb/ukbd.c	Sat Sep 27 15:13:31 2003
@@ -732,10 +732,10 @@
 	for (i = 0; i < NKEYCODE; i++) {
 		key = state->ks_odata.keycode[i];
 		if (key == 0)
-			break;
+			continue;
 		for (j = 0; j < NKEYCODE; j++) {
 			if (ud->keycode[j] == 0)
-				break;
+				continue;
 			if (key == ud->keycode[j])
 				goto rfound;
 		}
@@ -748,11 +748,11 @@
 	for (i = 0; i < NKEYCODE; i++) {
 		key = ud->keycode[i];
 		if (key == 0)
-			break;
+			continue;
 		state->ks_ntime[i] = now + kbd->kb_delay1;
 		for (j = 0; j < NKEYCODE; j++) {
 			if (state->ks_odata.keycode[j] == 0)
-				break;
+				continue;
 			if (key == state->ks_odata.keycode[j]) {
 				state->ks_ntime[i] = state->ks_otime[j];
 				if (state->ks_otime[j] > now)
]]]

Yes, I'm composing this email with my usb->ps/2 adaptor and my
favorite ps/2 keyboard. :D

I'll sendpr with this patch.  Enjoy the patch. :)


plasma


==========================================================
 ¦¬¨ì±b³æ«á³Ì¾á¤ßªº¨Æ
 http://edm-prg.epaper.com.tw/click.php?ad_code=25227
==========================================================
 PChome½u¤WÁʪ«¶g¦~¼y¡G©â¨T¨®¡BDV¤Ñ¤Ñ°e
 http://shopping.pchome.com.tw/
==========================================================


More information about the freebsd-stable mailing list