CentOS 6.4关闭触控板


CentOS 6.4关闭触控板

1. 检查是否安装xorg-x11-app;

rpm -qa xorg-x11-apps

如果没有安装使用下面命令安装xorg-x11-app

yum install xorg-x11-apps

2.查看在图形模式下可用的输入设备

xinput list

我的电脑显示的是如下结果

[root@reage input]# xinput list
⎡ Virtual core pointer                     id=2 [master pointer  (3)]
⎜  ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]
⎜  ↳ Macintosh mouse button emulation         id=14 [slave  pointer  (2)]
⎜  ↳ SIGMACHIP Usb Mouse                     id=15 [slave  pointer  (2)]
⎜  ↳ ImPS/2 Logitech Wheel Mouse             id=13 [slave  pointer  (2)]
⎣ Virtual core keyboard                   id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard             id=5 [slave  keyboard (3)]
    ↳ Asus Laptop extra buttons               id=6 [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard             id=7 [slave  keyboard (3)]
    ↳ Lid Switch                               id=8 [slave  keyboard (3)]
    ↳ USB 2.0 Camera                           id=9 [slave  keyboard (3)]
    ↳ Sleep Button                             id=10 [slave  keyboard (3)]
    ↳ Video Bus                               id=11 [slave  keyboard (3)]
    ↳ Power Button                             id=12 [slave  keyboard (3)]

3.查找触控板对应的设备好

不同的触控设备可能名字不同,但是一般触控板都是一个PS/2设备。所以在触控板的名字中可能会出现PS/2、touchpad字样。如果都找不到可以将Virtual core pointer 中的所有的设备id使用 xinput --set-prop 设备的id "Device Enabled" 0 依次执行,执行后滑动触控板看触控板是否可用,不可用表示已经找到,触控板对应的设备。然后使用xinput --set-prop 设备的id "Device Enabled" 1,将所有非触控板的输入设备依次启用。

4.书写自动禁用触控板的脚本

建立touchpad.sh

vim touchpad.sh

输入一下内容

#!/bin/bash
if [ "$1" = "on" ] || [ "$1" = "1" ]
then
        xinput --set-prop 13 "Device Enabled" 1
        echo "open"
elif [ "$1" = "off" ] || [ "$1" = "0" ]
then
        xinput --set-prop 13 "Device Enabled" 0
        echo "close"
else
        echo "请输入正确的参数:on/off 、0/1。"
        echo "开启触控板sh touchpad on或者sh touchpad 1。"
        echo "关闭触控板sh touchpad off或者sh touchpad 0";
fi

相关内容