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
This commit is contained in:
parent
4f0d668324
commit
dfc1c0ba36
@ -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
|
||||
|
@ -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 $*
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user