1、安装工具
xinput-calibrator工具:sudo apt-get install xinput-calibrator
xinput工具:sudo apt-get install xinput
2、校准实例
(1)查看触摸设备id:xinput_calibrator --list
上面可知:device name:ILITEK ILITEK-TP,device id:11
(2)校准触摸设备:xinput_calibrator -v --device <device name or id>
此处为xinput_calibrator -v --device 11
(3)在显示的屏幕触摸校准页面进行页面校准,终端会输出屏幕校准后的数据
(4)将屏幕校准数据根据提示复制至/etc/X11/xorg.conf.d/目录下的99-touchscreen-evdev.conf文件中,部分发行版系统下的路径为/usr/share/X11/xorg.conf.d/。如果没有99-touchscreen-evdev.conf文件可手动创建一个。
Section "InputClass"
Identifier "calibration"
MatchProduct "ILITEK ILITEK-TP"
Option "MinX" "20207"
Option "MaxX" "20343"
Option "MinY" "52844"
Option "MaxY" "54101"
Option "SwapXY" "1" # unless it was already set to 1
Option "InvertX" "0" # unless it was already set
Option "InvertY" "0" # unless it was already set
EndSection
(5)重启系统校准生效
3、相关问题
(1)屏幕旋转后校准未跟着旋转的问题
- 屏幕顺时针旋转270度时,添加Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"至99-touchscreen-evdev.conf,文件内容如下
Section "InputClass"
Identifier "calibration"
MatchProduct "ILITEK ILITEK-TP"
Option "MinX" "20207"
Option "MaxX" "20343"
Option "MinY" "52844"
Option "MaxY" "54101"
Option "SwapXY" "1" # unless it was already set to 1
Option "InvertX" "0" # unless it was already set
Option "InvertY" "0" # unless it was already set
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection
- 屏幕顺时针旋转180度时,添加Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"至99-touchscreen-evdev.conf
- 屏幕顺时针旋转90度时,添加Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"至99-touchscreen-evdev.conf
(2)校准不准的问题
- 上下相反,比如点击左上角,反馈至左下角,类似于Y轴方向改变
99-touchscreen-evdev.conf文件中Option的InvertY值:"0"改为"1"
- 左右相反,比如点击左上角,反馈至右上角,类似于X轴方向改变
99-touchscreen-evdev.conf文件中Option的InvertX值:"0"改为"1"
- XY相反,比如点击左上角,反馈至右下角,类似于X、Y轴方向改变
99-touchscreen-evdev.conf文件中Option的SwapXY值:"0"改为"1"
- 边缘偏移,比如点击最外侧,反馈却在旁边,说明位置点未设置准确
修改99-touchscreen-evdev.conf文件中Option的MinX、MaxX、MinY、MaxY值,修改尝试一下