From owner-freebsd-stable@FreeBSD.ORG Sat Sep 27 00:30:10 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0122216A4B3 for ; Sat, 27 Sep 2003 00:30:10 -0700 (PDT) Received: from msx.pchome.com.tw (msx.pchome.com.tw [211.20.188.141]) by mx1.FreeBSD.org (Postfix) with ESMTP id 805B443FF5 for ; Sat, 27 Sep 2003 00:30:08 -0700 (PDT) (envelope-from plasmaball@pchome.com.tw) Received: from me (sw68-102-13.adsl.seed.net.tw [210.68.102.13]) by msx.pchome.com.tw (Tomail v3 Lilith) with SMTP id C524C65E98B for ; Sat, 27 Sep 2003 15:30:05 +0800 (CST) Received: (nullmailer pid 480 invoked by uid 1001); Sat, 27 Sep 2003 07:29:28 -0000 Date: Sat, 27 Sep 2003 15:29:28 +0800 From: plasma To: stable@freebsd.org Message-ID: <20030927072928.GA442@plasmanb.plasma.idv.tw> References: <20030925093548.GA1062@plasmanb.plasma.idv.tw> <20030926181607.GA927@plasmanb.plasma.idv.tw> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030926181607.GA927@plasmanb.plasma.idv.tw> User-Agent: Mutt/1.5.4i Subject: Re: USB keyboard problem X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2003 07:30:10 -0000 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 ========================================================== 收到帳單後最擔心的事 http://edm-prg.epaper.com.tw/click.php?ad_code=25227 ========================================================== PChome線上購物週年慶:抽汽車、DV天天送 http://shopping.pchome.com.tw/ ==========================================================