多屏与旋转
屏幕的旋转、多个屏幕的位置摆放、拓展与复制等,均可在系统的显示设置中修改
设置的名称一般叫做“Monitor Settings”或者“Display”
如果使用了触摸屏,多屏显示或旋转时可能会出现问题,下面介绍解决方法:
- 画面旋转了但触摸还是原来的方向
需要将触摸也旋转过来,首先使用xinput命令查看输入设备
root@firefly:~# xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ PixArt USB Optical Mouse id=7 [slave pointer (2)]
⎜ ↳ himax-touchscreen id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ adc-keys id=6 [slave keyboard (3)]
↳ rk805 pwrkey id=8 [slave keyboard (3)]
↳ fe6e0030.pwm id=9 [slave keyboard (3)]
↳ himax-touchscreen id=11 [slave keyboard (3)]
在Virtual core pointer中可以看到触摸屏设备是himax-touchscreen,id 为 10
然后修改/etc/X11/xorg.conf.d/05-touchscreen.conf为以下内容:
Section "InputClass"
Identifier "ff_touchscreen"
MatchProduct "himax-touchscreen"
Driver "libinput"
Option "CalibrationMatrix" "1 0 0 0 1 0 0 0 1"
EndSection
Identifier 是名称,可以随意起一个
MatchProduct 需要设置为刚才找到的触摸屏设备名称
重点是 Option “CalibrationMatrix”
正常情况下是"1 0 0 0 1 0 0 0 1"
向左旋转 90 度则应该设置为"0 -1 1 1 0 0 0 0 1"
向右旋转 90 度则应该设置为"0 1 0 -1 0 1 0 0 1"
上下颠倒(旋转 180 度)则应该设置为"-1 0 1 0 -1 1 0 0 1"
如果有多个触摸屏,在文件中添加多个 InputClass 即可
保存文件后重启生效
- 触摸一个屏幕但结果却反馈到了另一个屏幕
这是因为触摸输入和屏幕输出没有匹配,首先同样用xinput查看输入设备,假设依然是himax-touchscreen,id 10
再使用xrandr命令查看显示设备:
root@firefly:~# xrandr
Screen 0: minimum 320 x 200, current 2720 x 1280, maximum 8192 x 8192
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1080 60.00*+ 59.94
1920x1080i 60.00 59.94
......
......
800x600 60.32
720x480 60.00 60.00 59.94 59.94 59.94
DSI-1 connected 800x1280+1920+0 (normal left inverted right x axis y axis) 0mm x 0mm
800x1280 59.98*+
可以看到有两个屏幕,HDMI-1 和 DSI-1,而himax-touchscreen就是 DSI-1,然后进行映射,执行:
xinput map-to-output 10 DSI-1
10 就是himax-touchscreen的 id,将它映射到 DSI-1 上
此时查看触摸是否正常,确认无误后创建一个新文件/etc/X11/Xsession.d/90-touchscreen-map,将映射命令写入这个文件来持久化设置