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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=156331
@ -99,11 +99,11 @@ detach 100 {
|
|||||||
# When a USB keyboard arrives, attach it as the console keyboard.
|
# When a USB keyboard arrives, attach it as the console keyboard.
|
||||||
attach 100 {
|
attach 100 {
|
||||||
device-name "ukbd0";
|
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 {
|
detach 100 {
|
||||||
device-name "ukbd0";
|
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
|
# The entry below starts moused when a mouse is plugged in. Moused
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
. /etc/rc.subr
|
. /etc/rc.subr
|
||||||
|
|
||||||
name="syscons"
|
name="syscons"
|
||||||
|
extra_commands="setkeyboard"
|
||||||
|
setkeyboard_cmd="syscons_setkeyboard"
|
||||||
start_precmd="syscons_precmd"
|
start_precmd="syscons_precmd"
|
||||||
start_cmd="syscons_start"
|
start_cmd="syscons_start"
|
||||||
|
|
||||||
@ -42,6 +44,21 @@ start_cmd="syscons_start"
|
|||||||
kbddev=/dev/ttyv0
|
kbddev=/dev/ttyv0
|
||||||
viddev=/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()
|
syscons_precmd()
|
||||||
{
|
{
|
||||||
if [ ! -c $kbddev ]
|
if [ ! -c $kbddev ]
|
||||||
@ -62,8 +79,7 @@ syscons_start()
|
|||||||
# keyboard
|
# keyboard
|
||||||
#
|
#
|
||||||
if [ -n "${keyboard}" ]; then
|
if [ -n "${keyboard}" ]; then
|
||||||
echo -n ' keyboard'; kbdcontrol < ${kbddev} \
|
echo -n ' keyboard'; syscons_setkeyboard ${keyboard}
|
||||||
-k "${keyboard}" >/dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# keymap
|
# keymap
|
||||||
@ -207,4 +223,5 @@ syscons_start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
load_rc_config $name
|
load_rc_config $name
|
||||||
run_rc_command "$1"
|
run_rc_command $*
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user