#1490 fixing LCD driver update

This commit is contained in:
rootzoll
2020-09-02 14:52:17 +02:00
parent 6d129fc9e5
commit e0906bbd1e
5 changed files with 70 additions and 82 deletions

View File

@@ -326,7 +326,7 @@ if [ ${check} -eq 1 ]; then choice="1"; fi
if [ "${lcdrotate}" != "${choice}" ]; then
echo "LCD Rotate Setting changed .."
anychange=1
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${choice}
sudo /home/admin/config.scripts/blitz.lcd.sh rotate ${choice}
needsReboot=1
else
echo "LCD Rotate Setting unchanged."

View File

@@ -370,7 +370,7 @@ if [ "${#lcdrotate}" -eq 0 ]; then
fi
echo "Provisioning LCD rotate - run config script" >> ${logFile}
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${lcdrotate} >> ${logFile} 2>&1
sudo /home/admin/config.scripts/blitz.lcd.sh rotate ${lcdrotate} >> ${logFile} 2>&1
# TOUCHSCREEN
if [ "${#touchscreen}" -gt 0 ]; then

View File

@@ -263,6 +263,14 @@ if [ ${forceHDMIoutput} -eq 1 ]; then
exit 0
fi
################################
# UPDATE LCD DRIVERS IF NEEEDED
################################
if [ "${lcd2hdmi}" != "on" ]; then
sudo /home/admin/config.scripts/blitz.lcd.sh check-repair
fi
################################
# SSH SERVER CERTS RESET
# if a file called 'ssh.reset' gets

View File

@@ -2,13 +2,14 @@
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "flip/rotate the LCD screen"
echo "blitz.lcd.sh rotate [on|off]"
echo "blitz.lcd.sh image [path]"
echo "blitz.lcd.sh qr [datastring]"
echo "blitz.lcd.sh qr-console [datastring]"
echo "blitz.lcd.sh hide"
echo "blitz.lcd.sh hdmi [on|off]"
echo "# make changes to the LCD screen"
echo "# blitz.lcd.sh check-repair"
echo "# blitz.lcd.sh rotate [on|off]"
echo "# blitz.lcd.sh image [path]"
echo "# blitz.lcd.sh qr [datastring]"
echo "# blitz.lcd.sh qr-console [datastring]"
echo "# blitz.lcd.sh hide"
echo "# blitz.lcd.sh hdmi [on|off]"
exit 1
fi
@@ -27,12 +28,52 @@ fi
# 1. Parameter: lcd command
command=$1
# check if its updated kernel version of v1.6 base image
oldKernel = $(uname -srm | cut -d ' ' -f2 | cut -d '-' -f1 | grep -c '4.19.118')
oldDrivers = $(sudo cat /home/admin/LCD-show/.git/config | grep -c 'github.com/goodtft/LCD')
###################
# CHECK-REPAIR
# make sure that LCD drivers match linux kernel
# see issue: https://github.com/rootzoll/raspiblitz/pull/1490
###################
if [ "${command}" == "check-repair" ]; then
echo "# blitz.lcd.sh check-repair"
if [ ${oldKernel} -eq 1 ]; then
echo "# --> old kernel detected - no need to update LCD drivers."
else
echo "# --> new kernel detected - checking if LCD driver needs update ..."
if [ ${oldDrivers} -eq 1 ]; then
echo "# --> old LCD driver detected - starting update ..."
cd /home/admin
sudo -u admin git clone https://github.com/MrYacha/LCD-show.git
sudo -u admin chmod -R 755 LCD-show
sudo -u admin chown -R admin:admin LCD-show
cd LCD-show/
sudo -u admin git reset --hard 53dd0bf
echo "# --> correcting rotate setting"
if [ "${lcdrotate}" == "on" ]; then
sudo sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" /boot/config.txt
else
sudo sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" /boot/config.txt
fi
echo "# --> restart to acrivate new driver"
./LCD35-show
sudo shutdown -r now
exit
else
echo "# --> new LCD driver detected - no need to update LCD drivers."
fi
fi
###################
# ROTATE
# see issue: https://github.com/rootzoll/raspiblitz/issues/681
###################
if [ "${command}" == "rotate" ]; then
elif [ "${command}" == "rotate" ]; then
# TURN ROTATE ON (the new default)
if [ "$2" = "1" ] || [ "$2" = "on" ]; then
@@ -43,8 +84,12 @@ if [ "${command}" == "rotate" ]; then
if [ ${#lcdrotate} -eq 0 ]; then
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
fi
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
if [ ${oldDrivers} -eq 1 ]; then
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
else
sudo sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" /boot/config.txt
fi
sudo sed -i "s/^lcdrotate=.*/lcdrotate=1/g" /mnt/hdd/raspiblitz.conf
# delete possible touchscreen rotate
@@ -57,7 +102,11 @@ if [ "${command}" == "rotate" ]; then
echo "#Turn OFF: LCD ROTATE"
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
if [ ${oldDrivers} -eq 1 ]; then
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
else
sudo sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" /boot/config.txt
fi
sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf
# if touchscreen is on

View File

@@ -1,69 +0,0 @@
#!/bin/bash
# see issue: https://github.com/rootzoll/raspiblitz/issues/681
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "flip/rotate the LCD screen"
echo "blitz.lcdrotate.sh [on|off]"
exit 1
fi
###################
# SWITCH ON
###################
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "Turn ON: LCD ROTATE"
# add default 'lcdrotate' raspiblitz.conf if needed
if [ ${#lcdrotate} -eq 0 ]; then
echo "lcdrotate=1" >> /mnt/hdd/raspiblitz.conf
fi
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
sudo sed -i "s/^lcdrotate=.*/lcdrotate=1/g" /mnt/hdd/raspiblitz.conf
# delete possible touchscreen rotate
sudo rm /etc/X11/xorg.conf.d/40-libinput.conf >/dev/null
echo "OK - a restart is needed: sudo shutdown -r now"
fi
###################
# SWITCH OFF
###################
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "Turn OFF: LCD ROTATE"
# add default 'lcdrotate' raspiblitz.conf if needed
if [ ${#lcdrotate} -eq 0 ]; then
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
fi
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf
# if touchscreen is on
if [ "${touchscreen}" = "1" ]; then
echo "Also rotate touchscreen ..."
cat << EOF | sudo tee /etc/X11/xorg.conf.d/40-libinput.conf >/dev/null
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
EOF
fi
echo "OK - a restart is needed: sudo shutdown -r now"
fi