我正在尝试校准 Ubuntu 20.04(带 Xorg 的服务器)的旧触摸屏。有问题的触摸屏是 General Touch RTL224。开箱后,我可以插入 USB 触摸屏,它会被识别,点击屏幕也会有效果。无论我在物理屏幕上点击什么位置,当前的触摸输入都只显示在左上角(距离侧面和顶部边缘不超过 100 像素)——并且 Y 输入(上/下)是反转的。我相当有信心我可以修复 Y 输入反转的问题;我目前只专注于让输入显示在整个屏幕上。
运行时有以下属性xinput list-props
:
Device 'USB Touchscreen 0dfc:0001':
Device Enabled (147): 1
Coordinate Transformation Matrix (149): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (302): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (303): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (267): 1, 0
libinput Send Events Mode Enabled (268): 0, 0
libinput Send Events Mode Enabled Default (269): 0, 0
Device Node (270): "/dev/input/event7"
Device Product ID (271): 3580, 1
我尝试运行xinput_calibrator -v
并得到以下输出
DEBUG: XInputExtension version is 2.3
DEBUG: Skipping virtual master devices and devices without axis valuators.
DEBUG: Skipping device 'Virtual core XTEST pointer' id=4, does not report Absolute events.
DEBUG: Skipping device 'Logitech K400' id=9, does not report Absolute events.
DEBUG: Selected device: USB Touchscreen 0dfc:0001
DEBUG: Not usbtouchscreen calibrator: Not a usbtouchscreen device
DEBUG: Not evdev calibrator: Evdev: invalid "Evdev Axis Calibration" property format
Calibrating standard Xorg driver "USB Touchscreen 0dfc:0001"
current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
DEBUG: Found that 'USB Touchscreen 0dfc:0001' is a sysfs name.
DEBUG: Adding click 0 (X=27, Y=40)
DEBUG: Adding click 1 (X=72, Y=39)
DEBUG: Adding click 2 (X=26, Y=22)
DEBUG: Adding click 3 (X=72, Y=22)
--> Making the calibration permanent <--
DEBUG: Found that 'USB Touchscreen 0dfc:0001' is a sysfs name.
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
Identifier "calibration"
MatchProduct "USB Touchscreen 0dfc:0001"
Option "MinX" "738"
Option "MaxX" "3104"
Option "MinY" "2647"
Option "MaxY" "1191"
Option "SwapXY" "0" # unless it was already set to 1
Option "InvertX" "0" # unless it was already set
Option "InvertY" "0" # unless it was already set
EndSection
如果我复制代码片段并创建文件,/usr/share/X11/xorg.conf.d/99-calibration.conf
重启后似乎没有任何变化。
我曾尝试切换到 evdev,但没有成功 —— 无论如何这似乎不被推荐。
我可以运行sudo evtest
,并且得到范围在 ~400 和 ~1550 之间的 X 值,范围在 ~610 和 ~1325 之间的 Y 值。这表明触摸屏本身没有问题 - 只是将输入转换为屏幕上的像素坐标存在问题。
还有其他调试步骤吗?设置此触摸屏时我是否还缺少其他东西?我已经设置了类似的触摸屏,它们似乎开箱即用。
答案1
我能够使用 reinderien 的 xcalibrate 校准工具对其进行校准。该工具可在 GitHub 上找到:https://github.com/reinderien/xcalibrate