我必须使用什么“坐标转换矩阵”才能使我的触摸屏正常工作?

我必须使用什么“坐标转换矩阵”才能使我的触摸屏正常工作?

有人能帮我吗?我快要抓狂了。我已经尝试了好几天才弄清楚。

Ubuntu 18.04.4 显示设置:右触摸框:IRTOUCH系统

如果我在终端中使用以下命令尝试校准我的触摸,我会得到以下结果

xinput set-prop "USB Touchscreen 6615:0001"  --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

我的左/右是正确的,但我的上/下不正确

如果我用

xinput set-prop "USB Touchscreen 6615:0001"  --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1

我的左/右不正确,但我的上/下是正确的

我正在尝试找出使用哪种组合来正确配置我的触摸。我尝试安装从制造商处下载的驱动程序,但还是不起作用。有谁知道我必须使用什么“坐标变换矩阵”才能使我的左/右和上/下正常工作。

答案1

我设法搞清楚了这一点。对于这个特定的触摸框架,有两种不同的坐标变换矩阵组合。这取决于屏幕旋转以及触摸面板是否正确安装或错误地“倒置”

左屏旋转 - 正确安装触摸屏 xinput set-prop “USB 触摸屏 6615:0001” --type=float “坐标变换矩阵” 0 -1 1 -1 0 1 0 0 1

左屏旋转 - 触摸屏安装不正确 xinput set-prop “USB 触摸屏 6615:0001” --type=float “坐标变换矩阵” 0 1 0 1 0 0 0 0 1

右屏幕旋转 - 正确安装触摸屏 xinput set-prop “USB 触摸屏 6615:0001” --type=float “坐标变换矩阵” 0 1 0 1 0 0 0 0 1

右屏幕旋转 - 触摸屏安装不正确

xinput set-prop "USB 触摸屏 6615:0001" --type=float "坐标变换矩阵" 0 -1 1 -1 0 1 0 0 1

希望这对将来的某人有所帮助

答案2

为了防止其他人偶然发现这个线程并寻找使用特定旋转配置指向显示器的指针的方法,我会在这里链接我的脚本:https://github.com/SimonLammer/dotfiles/blob/0b98315b06b9393df6235457007b84831f1646f5/data/scripts/xinput-configure-pointer

#!/bin/sh
# Limits a pointer to a display with an orientation.
# This can be used to limit a rotated graphics tablet to one display.

set -e

ZENITY='zenity --width 500 --height 500'

# Select pointer
pointers=`xinput | grep pointer | tail -n +2 | sed -E 's/[^a-zA-Z0-9]*((\S+ ?)+[a-zA-Z0-9\(\)]+)\s*id=([0-9]+)\s*(.*)/"\3" "\1" "\4"/'`
#echo $pointers
pointer=`echo $pointers | xargs $ZENITY --list --text "Choose a pointer" --column Id --column Name --column Info`
#echo $pointer

# Select display
displays=`xrandr | grep \ con | sed -E 's/(\S+)[^0-9]*(.*)/"\1" "\2"/'`
#echo $displays
display=`echo $displays | xargs $ZENITY --list --text "Choose a display" --column Id --column Info`
#echo $display

# Map pointer to display to get initial coordinate transformation matrix
xinput map-to-output "$pointer" "$display"
mat0=`xinput list-props $pointer | grep "Coordinate Transformation Matrix" | cut -d ':' -f 2`

# Select orientation
o1="0°C"
o2="90°C"
o3="180°C"
o4="270°C"
orientation=`$ZENITY --list --text "Choose an orientation" --column Orientation --column Name "$o1" "Normal" "$o2" "Rotate left" "$o3" "Invert" "$o4" "Rotate right"`
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
if [ "$orientation" = "$o1" ]; then
  mat1="1 0 0 0 1 0 0 0 1"
elif [ "$orientation" = "$o2" ]; then
  mat1="0 -1 1 1 0 0 0 0 1"
elif [ "$orientation" = "$o3" ]; then
  mat1="-1 0 1 0 -1 1 0 0 1"
else
  mat1="0 1 0 -1 0 1 0 0 1"
fi

# Multiply matrices (mat2 = mat0 * mat1)
# https://www.mymathtables.com/calculator/matrix/3-cross-3-matrix-multiplication.html
perl_expr="@a=split(/,? /,'$mat0');@b=split(/ /,'$mat1');print \"\"\
  .(\$a[0]*\$b[0]+\$a[1]*\$b[3]+\$a[2]*\$b[6]).\" \".(\$a[0]*\$b[1]+\$a[1]*\$b[4]+\$a[2]*\$b[7]).\" \".(\$a[0]*\$b[2]+\$a[1]*\$b[5]+\$a[2]*\$b[8]).\" \"\
  .(\$a[3]*\$b[0]+\$a[4]*\$b[3]+\$a[5]*\$b[6]).\" \".(\$a[3]*\$b[1]+\$a[4]*\$b[4]+\$a[5]*\$b[7]).\" \".(\$a[3]*\$b[2]+\$a[4]*\$b[5]+\$a[5]*\$b[8]).\" \"\
  .(\$a[6]*\$b[0]+\$a[7]*\$b[3]+\$a[8]*\$b[6]).\" \".(\$a[6]*\$b[1]+\$a[7]*\$b[4]+\$a[8]*\$b[7]).\" \".(\$a[6]*\$b[2]+\$a[7]*\$b[5]+\$a[8]*\$b[8]).\" \"\
  .\"\\n\""
#echo $perl_expr
mat2=`perl -E "$perl_expr"`

xinput set-prop "$pointer" --type=float "Coordinate Transformation Matrix" $mat2

相关内容