Linux禁用和启用触摸板:


yum -y install xorg-x11-apps


xinput list
 Virtual core pointer                        id=2    [master pointer  (3)]
   Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
   TPPS/2 IBM TrackPoint                       id=6    [slave  pointer  (2)]
   Macintosh mouse button emulation            id=12    [slave  pointer  (2)]
   Logitech Lenovo USB Optical Mouse           id=14    [slave  pointer  (2)]
   SynPS/2 Synaptics TouchPad                  id=13    [slave  pointer  (2)]
Virtual core keyboard                       id=3    [master keyboard (2)]
    Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    AT Translated Set 2 keyboard                id=7    [slave  keyboard (3)]
    Integrated Camera                           id=8    [slave  keyboard (3)]
    Sleep Button                                id=9    [slave  keyboard (3)]
    Lid Switch                                  id=10    [slave  keyboard (3)]
    Power Button                                id=11    [slave  keyboard (3)]



xinput list-props "SynPS/2 Synaptics TouchPad"      //引号中的名字因设备而异 
     
#禁用 
xinput   set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0 
     
#恢复 
xinput   set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1


每次禁用或者启用都敲一堆命令着实不方便,所以将它写成一个可执行脚本,如下:

#!/bin/sh  
# test  
case $1 in 
0) 
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0 
;; 
1) 
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1 
;; 
esac


最后 chmod +x enable_touchpad.sh

禁用触摸板:./enable_touchpad.sh 0

回复触摸板:./enable_touchpad.sh 1


--set-prop

set-prop 是等效的。