【树莓派】显示屏(触摸屏)设置

版权声明:本文为博主原创文章,转载请注明出处。 https://www.cnblogs.com/YaoYing/p/12105771.html

显示屏(触摸屏)设置

屏幕旋转

修改/boot/config.txt文件

sudo vim /boot/config.txt

根据需求在文件最后一行添加其中一条语句

display_rotate=0 旋转0度

display_rotate=1 旋转90度

display_rotate=2 旋转180度

display_rotate=3 旋转270度

最后重启设备即可

触摸旋转

如果显示屏是触摸屏,那么显示旋转的同时也需对触摸功能进行旋转,否则会导致触摸位置不正确。

安装libinput

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

/etc/X11/下创建xorg.conf.d目录 (如果该目录存在,直接跳过该操作)

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

复制/usr/share/X11/xorg.conf.d/40-libinput.conf文件到刚刚创建的目录下

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

修改touchscreen部分,根据需求在最后一行添加其中一条语句

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"

最后重启设备即可

更新日期20191227
如有错误之处,请评论或者私信指出,非常感谢!

posted @ 2019-12-27 09:54  妖影8023  阅读(2006)  评论(0编辑  收藏  举报