summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2006-03-06 06:38:34 +0000
committeremax <emax@FreeBSD.org>2006-03-06 06:38:34 +0000
commit2c76f6757ed83ab49320bc8add1d9717493b19ce (patch)
tree667a92a9f95efaaedfbd3def5535bb15d742f3f3
parent6401ef60bd59c05126a12e332c4d5013372c9e34 (diff)
downloadFreeBSD-src-2c76f6757ed83ab49320bc8add1d9717493b19ce.zip
FreeBSD-src-2c76f6757ed83ab49320bc8add1d9717493b19ce.tar.gz
Add new 'setkeyboard' method to the /etc/rc.d/syscons. It accepts the
keyboard device name (i.e. /dev/kbd0). This method will do nothing is kbdmux(4) is the current active keyboard, otherwise it will switch active keyboard as requested. Modify ukbd(4) entries in the /etc/devd.conf to use /etc/rc.d/syscons and new 'setkeyboard' method. No comments from: freebsd-current@ MFC after: 1 day
-rw-r--r--etc/devd.conf4
-rw-r--r--etc/rc.d/syscons23
2 files changed, 22 insertions, 5 deletions
diff --git a/etc/devd.conf b/etc/devd.conf
index 0c4ed14..5385e06 100644
--- a/etc/devd.conf
+++ b/etc/devd.conf
@@ -99,11 +99,11 @@ detach 100 {
# 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
diff --git a/etc/rc.d/syscons b/etc/rc.d/syscons
index b525f5e..751f69a 100644
--- a/etc/rc.d/syscons
+++ b/etc/rc.d/syscons
@@ -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 @@ start_cmd="syscons_start"
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 @@ syscons_start()
# 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 @@ syscons_start()
}
load_rc_config $name
-run_rc_command "$1"
+run_rc_command $*
+
OpenPOWER on IntegriCloud