From 6fc8bb3fd9268f35c764afd0c0bb518061a52492 Mon Sep 17 00:00:00 2001 From: Maksim Yevmenkin Date: Thu, 16 Mar 2006 17:42:28 +0000 Subject: [PATCH] Reorganize /etc/rc.d/syscons and move all keyboard related settings into one function syscons_configure_keyboard(). Call new function from both syscons_start() and sysconst_setkeyboard(). The reason for this is because syscons_start() will (re)configure both keyboard and screen settings. Apparently, some graphics cards have problems with running vidcontrol(1) while X11 is running. Remove "/etc/rc.d/syscons restart" from /etc/devd.conf. It is no longer required. Using "/etc/rc.d/syscons setkeyboard" is enough. This also should fix annoying "syscons not running?" message. Tested by: Ulrich Spoerlein < q at galgenberg dot net > MFC after: 3 days --- etc/devd.conf | 2 +- etc/rc.d/syscons | 102 ++++++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/etc/devd.conf b/etc/devd.conf index 5385e06af913..a8d77162d85d 100644 --- a/etc/devd.conf +++ b/etc/devd.conf @@ -99,7 +99,7 @@ detach 100 { # When a USB keyboard arrives, attach it as the console keyboard. attach 100 { device-name "ukbd0"; - action "/etc/rc.d/syscons setkeyboard /dev/ukbd0 && /etc/rc.d/syscons restart"; + action "/etc/rc.d/syscons setkeyboard /dev/ukbd0"; }; detach 100 { device-name "ukbd0"; diff --git a/etc/rc.d/syscons b/etc/rc.d/syscons index 751f69a5089c..f4eccf7ce543 100644 --- a/etc/rc.d/syscons +++ b/etc/rc.d/syscons @@ -44,44 +44,9 @@ start_cmd="syscons_start" kbddev=/dev/ttyv0 viddev=/dev/ttyv0 -syscons_setkeyboard() +# helper +syscons_configure_keyboard() { - 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 ] - then - return 1 - fi - if [ -x /usr/sbin/ispcvt ] && /usr/sbin/ispcvt - then - return 1 - fi - return 0 -} - -syscons_start() -{ - echo -n 'Configuring syscons:' - - # keyboard - # - if [ -n "${keyboard}" ]; then - echo -n ' keyboard'; syscons_setkeyboard ${keyboard} - fi - # keymap # case ${keymap} in @@ -127,6 +92,60 @@ syscons_start() ;; esac + # set this keyboard mode for all virtual terminals + # + if [ -n "${allscreens_kbdflags}" ]; then + echo -n ' allscreens_kbd' + for ttyv in /dev/ttyv*; do + kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1 + done + fi +} + +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 + + echo -n 'Configuring keyboard:' + syscons_configure_keyboard + echo '.' +} + +syscons_precmd() +{ + if [ ! -c $kbddev ] + then + return 1 + fi + if [ -x /usr/sbin/ispcvt ] && /usr/sbin/ispcvt + then + return 1 + fi + return 0 +} + +syscons_start() +{ + echo -n 'Configuring syscons:' + + # keyboard + # + if [ -n "${keyboard}" ]; then + echo -n ' keyboard'; syscons_setkeyboard ${keyboard} + fi + + syscons_configure_keyboard + # cursor type # case ${cursor} in @@ -210,15 +229,6 @@ syscons_start() done fi - # set this keyboard mode for all virtual terminals - # - if [ -n "${allscreens_kbdflags}" ]; then - echo -n ' allscreens_kbd' - for ttyv in /dev/ttyv*; do - kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1 - done - fi - echo '.' }