模板:Capacitive Screen Touch Rotate in Linux
来自丢石头百科
旋转
- 显示旋转
在config.txt文件中加入语句(config文件位于TF卡根目录,即/boot中):
display_rotate=1 #1:90;2: 180; 3: 270
注:如果是Raspberry Pi 4,还需要把dtoverlay=vc4-fkms-V3D注释掉。
保存后重启树莓派即可
sudo reboot
- 触摸旋转
在进行显示旋转后,由于触摸并没有随着显示角度做出更改,导致触摸位置不对。所以需要对触摸做出修改。
1. 安装libinput
sudo apt-get install xserver-xorg-input-libinput
2. 在/etc/X11/下创建xorg.conf.d目录 (如果该目录已存在,这直接进行第3步)
sudo mkdir /etc/X11/xorg.conf.d
3. 复制40-libinput-conf 文件到刚刚创建的目录下
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
4. 编辑该文件。 找到 touchscreen的部分。在里面添加以下语句,然后保存即可
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
sudo reboot
完成以上步骤即可进行90度旋转。
注:
90 度旋转: Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
180度旋转: Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
270度旋转: Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"