Date: Thu, 02 Mar 2006 11:04:41 -0800 From: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> To: freebsd-current@freebsd.org Subject: Re: [PATCH] kbdmux(4) and devd(8) Message-ID: <440741C9.7010802@savvis.net> In-Reply-To: <20060302183551.GD12226@odin.ac.hmc.edu> References: <44062DE7.8090508@savvis.net> <20060302180612.GB12226@odin.ac.hmc.edu> <44073955.6050202@savvis.net> <20060302183551.GD12226@odin.ac.hmc.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------000400090404080209070807 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Dear Hackers, any comments/objections/etc. to the attached patch? the idea is to prevent devd(8) from trying to switch keyboards when kbdmux(4) is the default keyboard. thanks, max --------------000400090404080209070807 Content-Type: text/plain; name="kbdmux-etc.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kbdmux-etc.diff.txt" Index: etc/devd.conf =================================================================== RCS file: /home/ncvs/src/etc/devd.conf,v retrieving revision 1.30 diff -u -r1.30 devd.conf --- etc/devd.conf 11 Dec 2005 00:18:28 -0000 1.30 +++ etc/devd.conf 2 Mar 2006 18:56:55 -0000 @@ -99,11 +99,11 @@ # When a USB keyboard arrives, attach it as the console keyboard. attach 100 { device-name "ukbd0"; - action "kbdcontrol -k /dev/ukbd0 < /dev/console && /etc/rc.d/syscons restart"; + action "/etc/rc.d/syscons setkeyboard /dev/ukbd0 && /etc/rc.d/syscons restart"; }; detach 100 { device-name "ukbd0"; - action "kbdcontrol -k /dev/kbd0 < /dev/console"; + action "/etc/rc.d/syscons setkeyboard /dev/kbd0"; }; # The entry below starts moused when a mouse is plugged in. Moused Index: etc/rc.d/syscons =================================================================== RCS file: /home/ncvs/src/etc/rc.d/syscons,v retrieving revision 1.14 diff -u -r1.14 syscons --- etc/rc.d/syscons 15 Dec 2005 01:04:48 -0000 1.14 +++ etc/rc.d/syscons 2 Mar 2006 18:56:55 -0000 @@ -34,6 +34,8 @@ . /etc/rc.subr name="syscons" +extra_commands="setkeyboard" +setkeyboard_cmd="syscons_setkeyboard" start_precmd="syscons_precmd" start_cmd="syscons_start" @@ -42,6 +44,21 @@ kbddev=/dev/ttyv0 viddev=/dev/ttyv0 +syscons_setkeyboard() +{ + kbd=$1 + + if [ -z "${kbd}" ]; then + return 1 + fi + + # Check if the kbdmux(4) is the current active keyboard + kbdcontrol -i < ${kbddev} | grep kbdmux > /dev/null 2>&1 + if [ $? != 0 ]; then + kbdcontrol -k ${kbd} < ${kbddev} > /dev/null 2>&1 + fi +} + syscons_precmd() { if [ ! -c $kbddev ] @@ -62,8 +79,7 @@ # keyboard # if [ -n "${keyboard}" ]; then - echo -n ' keyboard'; kbdcontrol < ${kbddev} \ - -k "${keyboard}" >/dev/null + echo -n ' keyboard'; syscons_setkeyboard ${keyboard} fi # keymap @@ -207,4 +223,5 @@ } load_rc_config $name -run_rc_command "$1" +run_rc_command $* + --------------000400090404080209070807--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?440741C9.7010802>