From f5c474ac492c2964ae924f69a57eaca8c953221c Mon Sep 17 00:00:00 2001 From: goodtft Date: Fri, 26 Jan 2024 10:09:28 +0000 Subject: [PATCH] modify 5inch and 4inch HDMI driver --- LCD5-show | 3 +++ MPI4008-show | 7 +++++++ system_config.sh | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/LCD5-show b/LCD5-show index d56b4d3..408edfb 100755 --- a/LCD5-show +++ b/LCD5-show @@ -16,6 +16,9 @@ row=`grep -nr "#dtoverlay=vc4-fkms-v3d" ./boot/config.txt.bak | awk -F ':' '{if( sudo sed -i -e ''"$row"'s/#dtoverlay=vc4-fkms-v3d/dtoverlay=vc4-fkms-v3d/' ./boot/config.txt.bak sudo sed -i -e 's/#max_framebuffers=2/max_framebuffers=2/' ./boot/config.txt.bak fi +if [ $hardware_model -eq 5 ]; then +sudo sed -i -e 's/#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/' ./boot/config.txt.bak +fi sudo echo "hdmi_force_hotplug=1" >> ./boot/config.txt.bak sudo echo "dtparam=i2c_arm=on" >> ./boot/config.txt.bak sudo echo "dtparam=spi=on" >> ./boot/config.txt.bak diff --git a/MPI4008-show b/MPI4008-show index d4717f8..c0505a0 100755 --- a/MPI4008-show +++ b/MPI4008-show @@ -11,6 +11,9 @@ sudo ./system_backup.sh #fi source ./system_config.sh +if [ $hardware_model -eq 5 ]; then +sudo sed -i -e 's/#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/' ./boot/config.txt.bak +fi sudo echo "hdmi_force_hotplug=1" >> ./boot/config.txt.bak sudo echo "hdmi_force_edid_audio=1" >> ./boot/config.txt.bak sudo echo "dtparam=i2c_arm=on" >> ./boot/config.txt.bak @@ -27,6 +30,10 @@ sudo echo "hdmi_cvt 480 800 60 6 0 0 0" >> ./boot/config.txt.bak sudo echo "dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900" >> ./boot/config.txt.bak sudo cp -rf ./boot/config.txt.bak /boot/config.txt +if [ $hardware_model -eq 5 ]; then +sudo sed -i "/xrandr -o/d" /etc/xdg/lxsession/LXDE-pi/autostart +sudo echo "xrandr -o 1" >> /etc/xdg/lxsession/LXDE-pi/autostart +fi #sudo cp -rf ./boot/config-397.txt /boot/config.txt #if test "$root_dev" = "/dev/mmcblk0p7";then diff --git a/system_config.sh b/system_config.sh index d9aa851..f609e35 100755 --- a/system_config.sh +++ b/system_config.sh @@ -2,6 +2,7 @@ big_version=`lsb_release -r | awk -F ' ' '{printf $NF}'` deb_version=`cat /etc/debian_version | tr -d '\n'` +hw_result=`tr -d '\0' < /proc/device-tree/model` if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ] ; then hardware_arch=64 @@ -9,6 +10,12 @@ else hardware_arch=32 fi +if [[ $hw_result == *"Raspberry Pi 5"* ]]; then +hardware_model=5 +else +hardware_model=255 +fi + sudo raspi-config nonint do_wayland W1 if [ $hardware_arch -eq 32 ]; then