Linux 禁用笔记本触摸板

1. 查看有什么设备
xinput list

输出:

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ PS/2 Logitech Wheel Mouse                   id=14    [slave  pointer  (2)]
⎜   ↳ USB OPTICAL MOUSE                           id=10    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Video Bus                                   id=8    [slave  keyboard (3)]
    ↳ Sleep Button                                id=9    [slave  keyboard (3)]
    ↳ USB2.0 HD UVC WebCam                        id=11    [slave  keyboard (3)]
    ↳ Asus WMI hotkeys                            id=12    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=13    [slave  keyboard (3)]

那么PS/2 Logitech Wheel Mouse就是我的触摸板了. 设备id=14.

2. 查看触摸板属性

xinput list-props 14 或者
xinput list-props 'PS/2 Logitech Wheel Mouse'

输出

Device 'PS/2 Logitech Wheel Mouse':
    Device Enabled (136):    1
    Coordinate Transformation Matrix (138):    1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (262):    0
    Device Accel Constant Deceleration (263):    1.000000
    Device Accel Adaptive Deceleration (264):    1.000000
    Device Accel Velocity Scaling (265):    10.000000
    Device Product ID (254):    2, 1
    Device Node (255):    "/dev/input/event4"
    Evdev Axis Inversion (266):    0, 0
    Evdev Axes Swap (268):    0
    Axis Labels (269):    "Rel X" (146), "Rel Y" (147)
    Button Labels (270):    "Button Left" (139), "Button Middle" (140), "Button Right" (141), "Button Wheel Up" (142), "Button Wheel Down" (143)
    Evdev Middle Button Emulation (271):    0
    Evdev Middle Button Timeout (272):    50
    Evdev Third Button Emulation (273):    0
    Evdev Third Button Emulation Timeout (274):    1000
    Evdev Third Button Emulation Button (275):    3
    Evdev Third Button Emulation Threshold (276):    20
    Evdev Wheel Emulation (277):    0
    Evdev Wheel Emulation Axes (278):    0, 0, 4, 5
    Evdev Wheel Emulation Inertia (279):    10
    Evdev Wheel Emulation Timeout (280):    200
    Evdev Wheel Emulation Button (281):    4
    Evdev Drag Lock Buttons (282):    0

看到 Device Enabled (136): 1 为启动.

3. 开关触摸板

#禁用触摸板
xinput set-prop 14 'Device Enabled' 0  #通过设备编号+属性名禁用触摸板
xinput set-prop 'PS/2 Logitech Wheel Mouse' 'Device Enabled' 0 #通过设备名+属性名禁用触摸板
#启用触摸板
xinput set-prop 14 136 1 #通过设备编号+属性编号来设置
xinput set-prop 'PS/2 Logitech Wheel Mouse' 136 1 #通过设备名+属性编号启用

参考文献: http://www.chenyudong.com/archives/lenovo-laptop-disable-or-enable-touchpad-using-xinput-in-ubuntu.html#i

原文地址:https://www.cnblogs.com/gssl/p/4970732.html