查看输入设备
$ xinput
⎡ Virtual core pointer id=2[master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4[slave pointer (2)]
⎜ ↳ SIGMACHIP Usb Mouse id=11[slave pointer (2)]
⎜ ↳ FSPPS/2Sentelic FingerSensingPad id=14[slave pointer (2)]
⎣ Virtual core keyboard id=3[master keyboard (2)]
↳ Virtual core XTEST keyboard id=5[slave keyboard (3)]
...
开启和禁用
# 禁用
xinput--disable 14
# 启用
xinput--enable 14
查看设备是否识别:
cat /proc/bus/input/devices | grep -i touchpad -A6 -B1
开关TouchPad脚本:
#!/bin/bash
DEVICE=$( xinput | awk '/.*Touchpad/{print $5}' | awk -F = '{print $2}' )
echo "打开触摸板请输入1,关闭触摸板请输入2"
readi
case $i in
1)
xinput --enable $DEVICE
;;
2)
xinput --disable $DEVICE
;;
*)
echo "输入错误,直接退出"
;;
esac