From owner-freebsd-current@FreeBSD.ORG Thu Mar 2 18:28:46 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 44A3E16A422 for ; Thu, 2 Mar 2006 18:28:46 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from ismybrain.com (ismybrain.com [64.246.42.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id A2A6343D6B for ; Thu, 2 Mar 2006 18:28:42 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from [10.254.186.111] (localhost.localdomain [127.0.0.1]) by ismybrain.com (8.11.6/8.11.6) with ESMTP id k22ISdM22333; Thu, 2 Mar 2006 13:28:40 -0500 Message-ID: <44073955.6050202@savvis.net> Date: Thu, 02 Mar 2006 10:28:37 -0800 From: Maksim Yevmenkin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brooks Davis References: <44062DE7.8090508@savvis.net> <20060302180612.GB12226@odin.ac.hmc.edu> In-Reply-To: <20060302180612.GB12226@odin.ac.hmc.edu> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: [PATCH] kbdmux(4) and devd(8) 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, 02 Mar 2006 18:28:46 -0000 Brooks Davis wrote: > On Wed, Mar 01, 2006 at 03:27:35PM -0800, Maksim Yevmenkin wrote: > >>Dear Hackers, >> >>any comments/objections/etc. to the following devd.conf patch? the idea >>is to prevent devd(8) from trying to switch keyboards when kbdmux(4) is >>the default keyboard. >> >>the 'attach' action will fail anyway, however, the 'detach' action may >>succeed (if /dev/kbd0 is not is the kbdmux(4)). > > > This seems OK if a bit ugly to me. Another idea might be to add some > new methods to /etc/rc.d/syscons (or create a new keyboard management > script) to hide the logic there. do you mean something like --- syscons.orig Thu Jan 5 15:36:02 2006 +++ syscons Thu Mar 2 10:25:49 2006 @@ -34,8 +34,10 @@ . /etc/rc.subr name="syscons" +extra_commands="setkeyboard" start_precmd="syscons_precmd" start_cmd="syscons_start" +setkeyboard_cmd="syscons_setkeyboard" # stdin must be redirected because it might be for a serial console # @@ -206,5 +208,19 @@ echo '.' } +syscons_setkeyboard() +{ + kbd=$1 + + if [ -z "${kbd}" ]; then + return 1 + fi + + kbdcontrol -i < ${kbddev} | grep kbdmux > /dev/null 2>&1 + if [ $? != 0 ]; then + kbdcontrol -k /dev/${kbd} < ${kbddev} > /dev/null 2>&1 + fi +} + load_rc_config $name -run_rc_command "$1" +run_rc_command $* thanks, max