使用 input.agent 将允许您基于输入设备的 PHYS ID 管理它们。
input.rc 脚本将使用适当的参数运行 input.agent,以用于内核内置或在热插拔可用之前加载的驱动程序。
输入代理使用 3 个配置文件
/etc/hotplug/kbd.conf
/etc/hotplug/mouse.conf
/etc/hotplug/event.conf
![]() | 注意 |
|---|---|
此处的解释使用 Backstreet Ruby(usb 设备具有 PHYS_ID "usb-00:xx.x-..."),如果您为 usb 设备运行 Ruby-2.6,您应该具有 PHYS_ID "usb-0000:00:xx.x-....",但是通过指定 "usb-0*:xx.x-...",您应该能够在 Backstreet Ruby 和 Ruby-2.6 下使用相同的配置文件。 |
要配置键盘,您必须调整/etc/hotplug/kbd.conf
如果我想使用 PS2 键盘作为主显示器和 VGA 控制台,我将有
#
# keyboard configuration
#
# vt_name device_physicaly_location
VT0 isa0060/serio0/input0
VT1 usb-00:10.1-1.1/input0
|
或者,如果我想使用 USB 键盘作为主显示器和 VGA 控制台
#
# keyboard configuration
#
# vt_name device_physicaly_location
VT0 usb-00:10.1-1.1/input0
VT1 isa0060/serio0/input0
|
您也可以使用 "*.*" 代替 USB 控制器的 pci 功能
#
# keyboard configuration
#
# vt_name device_physicaly_location
VT0 usb-*.*-1.1/input0
VT1 isa0060/serio0/input0
|
对于鼠标设备,您必须编辑/etc/hotplug/mouse.conf
#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br usb-00:10.1-1.2/input0
mouse1br usb-*.*-2.7.*/input0
mouse2br isa0060/serio1/*
|
并调整 XFree 配置文件。
对于第一个鼠标,更改
......
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mouse0"
Option "ZAxisMapping" "4 5"
......
|
为
......
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mouse0br"
Option "ZAxisMapping" "4 5"
......
|
对于第二个鼠标,更改
......
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mouse1"
Option "ZAxisMapping" "4 5"
......
|
为
......
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mouse1br"
Option "ZAxisMapping" "4 5"
......
|
等等。
对于事件设备,编辑/etc/hotplug/event.conf
#
# input event device config file
#
# symbolic_link device_physicaly_location
event0br isa0060/serio0/*
event1br isa0060/serio1/input0
event2br usb-*.*-3/input0
|
并配置使用它们的应用程序以使用符号链接而不是实际设备
如果您使用内置于内核的输入驱动程序,请确保input.rc脚本在系统启动时启动/执行。如果脚本未执行,您将发现热插拔无法配置这些输入设备。
![]() | 注意 |
|---|---|
此区域需要用户反馈。目前我只有关于 Mandrake 的信息,其中热插拔未作为服务运行。 |
如果您的发行版将热插拔作为服务运行,这将自动完成。
如果您的发行版未将热插拔作为服务运行,您将必须修改您的 init 脚本以运行input.rc在 XFree 启动之前为您运行。
您可以将其添加到您的/etc/rc.d/rc.sysinit
if [[ -f /proc/bus/console -o -n tmp=`uname -r | sed -n 's:ruby::p'` ]]; then
if [ -x /etc/hotplug/input.rc ]; then
/etc/hotplug/input.rc start
if [ $? = 0 ]; then
action "Configuring cold plugged input devices" /bin/true
else
action "Configuring cold plugged input devices" /bin/false
fi
else if [ -f /etc/hotplug/input.rc ]; then
action "Input: input.rc installed, but not executable. Please check the file permissions." /bin/false
else
action "Input: Failed to configure cold plugged devices - input.rc missing" /bin/false
fi
fi
fi |