11 linux keyboard kernel-modules
在不拔掉键盘的情况下,我想从终端禁用它;我希望可以使用rmmod
它来完成,但根据我当前加载的模块,它看起来不可能。
有没有人有任何想法?
slm*_*slm 16
这里有很好的指导,标题为:在 Linux 中禁用/启用键盘和鼠标。
您可以使用此命令列出设备。
$ xinput --list
"Virtual core pointer" id=0 [XPointer]
"Virtual core keyboard" id=1 [XKeyboard]
"Keyboard2" id=2 [XExtensionKeyboard]
"Mouse2" id=3 [XExtensionKeyboard]
Run Code Online (Sandbox Code Playgroud)
并通过以下方式禁用键盘:
$ xinput set-int-prop 2 "Device Enabled" 8 0
Run Code Online (Sandbox Code Playgroud)
并用这个启用它:
$ xinput set-int-prop 2 "Device Enabled" 8 1
Run Code Online (Sandbox Code Playgroud)
这仅适用于通过 X 禁用键盘。因此,如果您在未运行 X 的系统上,这将不起作用。
您可以使用此命令获取给定设备的所有属性列表:
$ xinput --list-props 2
Device 'Virtual core keyboard':
Device Enabled (124): 1
Coordinate Transformation Matrix (126): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Run Code Online (Sandbox Code Playgroud)