初用鲁班猫切换屏幕为MIPI-1080P
鲁班猫信息:
板卡从如下地址采购:https://detail.tmall.com/item.htm?_u=110jcean66aa&id=694560455663&spm=a1z09.2.0.0.56f52e8dj4eUdI&skuId=5156903694777
鲁班猫官方文档和教程:https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/quick_start/lubancat/lubancat.html
视频教程:https://space.bilibili.com/356820657/channel/collectiondetail?sid=1352573
板子实物图如下:
烧录鲁班猫镜像
按照视频教程的说法这里使用EMMC烧录镜像,选择如下镜像:
E:\Study\鲁班猫\3-Linux镜像\Debian系统镜像\通用镜像(extboot)-适用于所有板卡\20230712\LubanCat-rk3566\lubancat-rk3566-debian10-xfce-20230712_update\lubancat-rk3566-debian10-xfce-20230712_update.img
注意:先短路MR点,再重新上电,这时候软件能够识别到MASKROM设备(如上图),然后再断开MR点,再点击升级按钮进行烧录
镜像烧录成功后可以看到下面的打印说明系统运行起来了,但是因为默认的屏幕使用的是HDMI的,而我们接的屏幕是MIPI的,所以我们看不到显示:
这里用串口登录系统
修改屏幕为MIPI
输入"fire-config"命令进入配置界面:
进入屏幕配置:
这里选择1080P:
注意:这里使用空格键进行切换(请看如下说明:https://doc.embedfire.com/linux/rk356x/quick_start/zh/latest/quick_start/fireconfig/fireconfig.html)
选择finish并且退出,然后输入"reboot"命令重启:
可以看到屏幕正常显示了:
鲁班猫修改屏幕适配MIPI
旋转屏幕为横屏显示
但是现在屏幕是竖屏的,我们的使用习惯是横屏的,进入系统,输入如下命令:
“xrandr --output DSI-1 --rotate left”
Last login: Thu Feb 14 18:13:09 CST 2019 on ttyFIQ0
OO OO
OOOO OOOO
OOOOO OOOOOO
OOOOOOO .OOOOOOO
OOOOOOOOO OOOOOOOOO
OOOOOOOOOOO OOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOO\ OOOOOOOOOOOO /OOOOO
OOOOOOOOO OOOOOO OOOOOOOO
OOOOO/ OOOOOOOOOOOOO \OOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOO\ ̄/OOOOOOOOOOOOOO
OOOOOOOOOOOOOOO\/OOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
_ _ ____ _
| | _ _ | |__ ____ _____ / ___| ____ | |_
| | | | | || '_ \ / _ || _ || | / _ || __|
| |___| |_| || |_) || (_| || | | || |___| (_| || |_
|_____|\__._||_.__/ \__'_||_| |_| \____|\__'_| \__|
Welcome to Debian GNU/Linux 10 (buster) (GNU/Linux 4.19.232 aarch64)
* Documentation: http://doc.embedfire.com
* Management: http://www.embedfire.com
Linux lubancat 4.19.232 #7 SMP Mon Jul 10 16:21:10 CST 2023 aarch64
System information as of Thu Feb 14 18:21:53 CST 2019
System load: 1.70 0.39 0.13 Up time: 0 min
Memory usage: 20 % of 1957MB IP:
CPU temp: 44°C GPU temp: 44°C
Usage of /: 42% of 7.1G
root@lubancat:~# xrand
-bash: xrand: command not found
root@lubancat:~# xrandr
Screen 0: minimum 320 x 200, current 1080 x 1920, maximum 8192 x 8192
DSI-1 connected primary 1080x1920+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1080x1920 60.00*+
root@lubancat:~# xrandr --help
usage: xrandr [options]
where options are:
--display <display> or -d <display>
--help
-o <normal,inverted,left,right,0,1,2,3>
or --orientation <normal,inverted,left,right,0,1,2,3>
-q or --query
-s <size>/<width>x<height> or --size <size>/<width>x<height>
-r <rate> or --rate <rate> or --refresh <rate>
-v or --version
-x (reflect in x)
-y (reflect in y)
--screen <screen>
--verbose
--current
--dryrun
--nograb
--prop or --properties
--fb <width>x<height>
--fbmm <width>x<height>
--dpi <dpi>/<output>
--output <output>
--auto
--mode <mode>
--preferred
--pos <x>x<y>
--rate <rate> or --refresh <rate>
--reflect normal,x,y,xy
--rotate normal,inverted,left,right
--left-of <output>
--right-of <output>
--above <output>
--below <output>
--same-as <output>
--set <property> <value>
--scale <x>x<y>
--scale-from <w>x<h>
--transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
--off
--crtc <crtc>
--panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
--gamma <r>:<g>:<b>
--brightness <value>
--primary
--noprimary
--newmode <name> <clock MHz>
<hdisp> <hsync-start> <hsync-end> <htotal>
<vdisp> <vsync-start> <vsync-end> <vtotal>
[flags...]
Valid flags: +HSync -HSync +VSync -VSync
+CSync -CSync CSync Interlace DoubleScan
--rmmode <name>
--addmode <output> <name>
--delmode <output> <name>
--listproviders
--setprovideroutputsource <prov-xid> <source-xid>
--setprovideroffloadsink <prov-xid> <sink-xid>
--listmonitors
--listactivemonitors
--setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}
--delmonitor <name>
root@lubancat:~# xrandr
Screen 0: minimum 320 x 200, current 1080 x 1920, maximum 8192 x 8192
DSI-1 connected primary 1080x1920+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1080x1920 60.00*+
root@lubancat:~# xrandr --output DSI-1 --rotate left
xrandr: --rotate: invalid argument 'leftxr'
Try 'xrandr --help' for more information.
root@lubancat:~# xrandr --output DSI-1 --rotate left
[ 511.134234] rockchip-vop2 fe040000.vop: [drm:vop2_crtc_atomic_disable] Crtc atomic disable vp0
[ 511.177205] [drm:vop2_plane_atomic_check] *ERROR* Cluster0-win0 is invisible(src: pos[0, 0] rect[64 x 64] dst: pos[833, 1856] rect[64 x 64]
[ 511.250694] rockchip-vop2 fe040000.vop: [drm:vop2_crtc_atomic_enable] Update mode to 1080x1920p0, type: 16 for vp0
[ 511.251431] dw-mipi-dsi fe060000.dsi: [drm:dw_mipi_dsi_encoder_enable] final DSI-Link bandwidth: 870 x 4 Mbps
root@lubancat:~#
可以看到屏幕变成了我们想要的横屏
但是这里发现触摸异常了
鲁班猫触摸异常
这里通过"fire-config"来修改触摸方向:
向左旋转90度:
选择finish推出后可以看到屏幕恢复正常:
鲁班猫触摸正常
屏幕和触摸方向修改永久保存
但是我测试发现这种方式在下次重启的时候又恢复成原来的竖屏了,这里要找到能够保存屏幕设置的方法才行!
按照鲁班猫官方的说法要解决这个问题就是开启一个自启动服务,这个服务去修改屏幕的方向,虽然我觉得这个不是最正宗的办法,后来根据官方的提醒修改"/etc/X11/xorg.conf.d/20-modesetting.conf"文件实现永久修改屏幕和触摸方向,修改后的"20-modesetting.conf"文件如下:
root@lubancat:~# cat /etc/X11/xorg.conf.d/20-modesetting.conf
Section "Device"
Identifier "Rockchip Graphics"
Driver "modesetting"
### Use Rockchip RGA 2D HW accel
# Option "AccelMethod" "exa"
### Use GPU HW accel
Option "AccelMethod" "glamor"
Option "DRI" "2"
### Set to "always" to avoid tearing, could lead to up 50% performance loss
Option "FlipFB" "none"
### Limit flip rate and drop frames for "FlipFB" to reduce performance lost
# Option "MaxFlipRate" "25"
Option "NoEDID" "true"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Rockchip Graphics"
Monitor "Default Monitor"
EndSection
### Valid values for rotation are "normal", "left", "right"
Section "Monitor"
Identifier "Default Monitor"
Option "Rotate" "left"
EndSection
Section "InputClass"
Identifier "Goodix Capacitive TouchScreen"
MatchProduct "Goodix Capacitive TouchScreen"
Option "TransformationMatrix" " 0 -1 1 1 0 0 0 0 1
EndSection
其中"Monitor"修改了屏幕的方向,"InputClass"修改了触摸的方向,实现效果其实和这两句话一样:
xrandr --output DSI-1 --rotate left
xinput set-prop 9 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
最终效果如下:
鲁班猫屏幕和触摸永久保存
这里还有一个问题,就是开机的时候log会输出到屏幕上,经过上面的修改后桌面的屏幕是反过来了,但是打印log的时候屏幕还没有反,这里修改"/boot/uEnv/uEnv.txt"文件如下:
uname_r=4.19.232
size=0x1000000
cmdline="earlyprintk console=ttyFIQ0 console=tty1 fbcon=rotate:3 consoleblank=0
loglevel=7 rootwait rw rootfstype=ext4"
enable_uboot_overlays=1
#overlay_start
#40pin
#dtoverlay=/dtb/overlay/rk3566-lubancat-msata-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-i2c3-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-i2c5-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm8-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm9-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm10-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm11-ir-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm12-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm13-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm13-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm14-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm14-m1-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm15-ir-m0-overlay.dtbo
#dtoverlay=/dtb/overlay/rk356x-lubancat-pwm15-ir-m1-overlay.dtbo
"/boot/uEnv/uEnv.txt" 51L, 2575C written
这里主要是增加了内容"fbcon=rotate:3"
最终效果如下:
鲁班猫开机log屏幕旋转