我正在使用 Ubuntu 12.10 和 xserver-xorg/quantal 1:7.7+1ubuntu4。
我有一台带有内置键盘的笔记本电脑,无法识别某些字母。我目前正在通过打开终端并运行以下 shell 函数来禁用内置键盘:
disable_keyboard () {
xinput --set-int-prop $(
xinput --list |
ruby -ane 'if /AT.*keyboard/ then puts $_.match(/(?<==)\d+/) end'
) "Device Enabled" 8 0
}
Run Code Online (Sandbox Code Playgroud)
这通过禁用内置的AT Translated Set 2 键盘同时允许我的外部Chicony USB 键盘继续工作来工作(尽管是手动的)。但是,我真的希望在 X11 会话期间自动发生这种情况。
我尝试如下修改我的 X.org 配置:
# /etc/X11/xorg.conf.d/disable_keyboard
Section "InputClass"
Identifier "disable built-in keyboard"
MatchIsKeyboard "on"
MatchProduct "AT Translated Set 2 keyboard"
Option "Ignore" "on"
EndSection
Run Code Online (Sandbox Code Playgroud)
然而,这要么不是 X11 启动时的来源,要么不是正确的咒语。如何正确配置 X11 以仅使用 USB 键盘?
通过将输入类中的Ignore选项设置为true或on,可以禁用内置设备。通常可以从 收集与设备匹配的必要信息/var/log/Xorg.0.log
。
我选择将禁用部分放置在已存在的 evdev 配置文件中,因为在我的系统上,两个设备都使用 evdev 驱动程序。这些部分可以很容易地转到其他地方,但我不确定匹配规则的优先级,因此决定将规则放在包含一行的其他设备上方的同一文件中,以确保安全Driver "evdev"
。
# /etc/X11/xorg.conf.d/10-evdev.conf
Section "InputClass"
Identifier "Built-In Touchpad"
MatchIsTouchpad "on"
MatchProduct "SynPS/2 Synaptics TouchPad"
Option "Ignore" "true"
EndSection
Section "InputClass"
Identifier "Built-In Keyboard"
MatchIsKeyboard "on"
MatchProduct "AT Translated Set 2 keyboard"
Option "Ignore" "true"
EndSection
Run Code Online (Sandbox Code Playgroud)