树莓派实现触摸翻转

7寸屏界面变竖后,sudo apt-get install xinput安装xinput,DISPLAY=:0 xinput --list看下屏幕的是哪个数值。假如数值是5,DISPLAY=:0 xinput --list-props 5,查看设备5的信息。

cd /etc/X11/xorg.conf.d/进入到这个目录

sudo nano 99-libinput.conf编辑这个非空的文件

(如果进入是一个空文件而不是非空文件,检查一下有没有输入错误,如果没有运行sudo nano 40-libinput.conf编辑这个非空的文件)

找到Touch

Section “InputClass“

Identifier “libinput touchscreen catchall“

MatchIsTouchscreen “on“

MatchDevicePath “/dev/input/event*“

Driver “libinput“

EndSection


旋转0度 添加这一行 Option "CalibrationMatrix" "1 0 0 0 1 0 0 0 1"

旋转90度 添加这一行 Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"

旋转-90度 添加这一行 Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"


树莓派实现触摸翻转_第1张图片

如旋转90度的结果为

Section “InputClass“

Identifier “libinput touchscreen catchall“

Option Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"

MatchIsTouchscreen “on“

MatchDevicePath “/dev/input/event*“

Driver “libinput“

EndSection

保存后重启就变成了竖屏触摸了


有的有效有的无效的方法:

3.5寸屏界面变竖后,sudo apt-get install xinput安装xinput,DISPLAY=:0 xinput --list看下屏幕的是哪个数值。假如数值是6,DISPLAY=:0 xinput --list-props 6,查看设备6的信息

1)所以先交换x、y轴

DISPLAY=:0 xinput --set-prop '6' 'Evdev Axes Swap' 0

2)然后反转y轴

DISPLAY=:0 xinput --set-prop '6' 'Evdev Axis Inversion' 0 1

就变成了竖屏触摸,不用重启系统就改变了触摸。

参考文档:

https://blog.csdn.net/u013491946/article/details/79895853

你可能感兴趣的:(树莓派实现触摸翻转)