From owner-freebsd-current@FreeBSD.ORG Thu Apr 27 23:43:30 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C45AF16A403 for ; Thu, 27 Apr 2006 23:43:30 +0000 (UTC) (envelope-from maksim.yevmenkin@savvis.net) Received: from mailgate1b.savvis.net (mailgate1b.savvis.net [216.91.182.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5668143D46 for ; Thu, 27 Apr 2006 23:43:29 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate1b.savvis.net (Postfix) with ESMTP id 58E913BE5A for ; Thu, 27 Apr 2006 18:43:29 -0500 (CDT) Received: from mailgate1b.savvis.net ([127.0.0.1]) by localhost (mailgate1b.savvis.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25769-01-6 for ; Thu, 27 Apr 2006 18:43:29 -0500 (CDT) Received: from [10.254.186.111] (sntc04ep01.savvis.net [64.14.1.106]) by mailgate1b.savvis.net (Postfix) with ESMTP id EA0CE3BE4F for ; Thu, 27 Apr 2006 18:43:28 -0500 (CDT) Message-ID: <44515720.8020908@savvis.net> Date: Thu, 27 Apr 2006 16:43:28 -0700 From: Maksim Yevmenkin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-current@freebsd.org Content-Type: multipart/mixed; boundary="------------040001030303040502090306" X-Virus-Scanned: amavisd-new at savvis.net Subject: [PATCH] kbdmux(4), atkbd(4) and ddb(4) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 23:43:30 -0000 This is a multi-part message in MIME format. --------------040001030303040502090306 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------040001030303040502090306 Content-Type: text/plain; name="atkbd.c.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="atkbd.c.diff.txt" --- atkbd.c.orig Thu Apr 27 16:29:26 2006 +++ atkbd.c Thu Apr 27 16:30:13 2006 @@ -26,7 +26,7 @@ */ #include -__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; } --------------040001030303040502090306--