ubuntu触摸屏旋转为横屏触摸不准问题解决(usb触摸屏、nano、ubuntu18.04)

参考文章:https://www.codetd.com/article/5651388

1.查看触摸屏驱动

xinput list
//情况如下,驱动为ILITEK Multi-Touch-V3000
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ ILITEK Multi-Touch-V3000                	id=9	[slave  pointer  (2)]
⎜   ↳ ILITEK Multi-Touch-V3000                	id=10	[slave  pointer  (2)]
⎜   ↳ A4Tech USB Mouse                        	id=8	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ gpio-keys                               	id=11	[slave  keyboard (3)]
    ↳ Logitech USB Keyboard                   	id=6	[slave  keyboard (3)]
    ↳ Logitech USB Keyboard                   	id=7	[slave  keyboard (3)]

我们再查一下它支持的属性,这里可以用它后面的id号9来查询

Device 'ILITEK Multi-Touch-V3000':
	Device Enabled (152):	1
	Coordinate Transformation Matrix (153):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Calibration Matrix (306):	0.000000, -1.000000, 1.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Calibration Matrix Default (307):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Send Events Modes Available (271):	1, 0
	libinput Send Events Mode Enabled (272):	0, 0
	libinput Send Events Mode Enabled Default (273):	0, 0
	Device Node (274):	"/dev/input/event2"
	Device Product ID (275):	8746, 1

可以看到,这里的输入是使用libinput进行管理的,所以当我们需要进行校正时,要进行其配置文件的修改

2.配置文件

2.1.查看/usr/share/X11/xorg.conf.d/目录下是否有40-libinput.conf这个文件。

  opt:           没有这个文件, 则需要安装               

sudo apt-get install xserver-xorg-input-libinput  

安装完成后ls一下,就可以看到在/usr/share/X11/xorg.conf.d/目录下存在该文件                           

2.2.复制该文件到/etc/X11/xorg.conf.d/目录下。

        opt:           一开始xorg.conf.d这个目录在/etc/X11可能没有,需要自己创建。

cd /etc/X11
sudo mkdir xorg.conf.d

 

sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
sudo gedit /etc/X11/xorg.conf.d/40-libinput.conf

 

2.3.进入/etc/X11/xorg.conf.d/目录下修改40-libinput.conf 文件

找到touchscreen section

在Identifier下添加一行 Option “CalibrationMatrix” “你的校准矩阵

我这里板子上需要旋转270度,所以写 Option "CalibrationMatrix" "0 1 0  -1 0 1 0 0 1"

90度       "0 -1 1 1 0 0 0 0 1"

180度      "-1 0 1 0  -1  1 0 0 1"

x ,y对调  "-1 0 1 1 0  0  0 0 1"

添加完成后

# Match on all types of devices but joysticks
Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchscreen catchall"
	Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

 

这里你的校准矩阵里面,需要根据实际情况进行校准矩阵的编写,可以参考

https://wayland.freedesktop.org/libinput/doc/latest/absolute-axes.html (打不开的可以看文末的网页截图)

来写校准矩阵。

-

  • 6
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值