mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-10 21:03:09 +02:00
#1490 fixing LCD driver update
This commit is contained in:
@@ -326,7 +326,7 @@ if [ ${check} -eq 1 ]; then choice="1"; fi
|
|||||||
if [ "${lcdrotate}" != "${choice}" ]; then
|
if [ "${lcdrotate}" != "${choice}" ]; then
|
||||||
echo "LCD Rotate Setting changed .."
|
echo "LCD Rotate Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${choice}
|
sudo /home/admin/config.scripts/blitz.lcd.sh rotate ${choice}
|
||||||
needsReboot=1
|
needsReboot=1
|
||||||
else
|
else
|
||||||
echo "LCD Rotate Setting unchanged."
|
echo "LCD Rotate Setting unchanged."
|
||||||
|
@@ -370,7 +370,7 @@ if [ "${#lcdrotate}" -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
|
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
|
# TOUCHSCREEN
|
||||||
if [ "${#touchscreen}" -gt 0 ]; then
|
if [ "${#touchscreen}" -gt 0 ]; then
|
||||||
|
@@ -263,6 +263,14 @@ if [ ${forceHDMIoutput} -eq 1 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
# SSH SERVER CERTS RESET
|
||||||
# if a file called 'ssh.reset' gets
|
# if a file called 'ssh.reset' gets
|
||||||
|
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
# command info
|
# command info
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "flip/rotate the LCD screen"
|
echo "# make changes to the LCD screen"
|
||||||
echo "blitz.lcd.sh rotate [on|off]"
|
echo "# blitz.lcd.sh check-repair"
|
||||||
echo "blitz.lcd.sh image [path]"
|
echo "# blitz.lcd.sh rotate [on|off]"
|
||||||
echo "blitz.lcd.sh qr [datastring]"
|
echo "# blitz.lcd.sh image [path]"
|
||||||
echo "blitz.lcd.sh qr-console [datastring]"
|
echo "# blitz.lcd.sh qr [datastring]"
|
||||||
echo "blitz.lcd.sh hide"
|
echo "# blitz.lcd.sh qr-console [datastring]"
|
||||||
echo "blitz.lcd.sh hdmi [on|off]"
|
echo "# blitz.lcd.sh hide"
|
||||||
|
echo "# blitz.lcd.sh hdmi [on|off]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -27,12 +28,52 @@ fi
|
|||||||
# 1. Parameter: lcd command
|
# 1. Parameter: lcd command
|
||||||
command=$1
|
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
|
# ROTATE
|
||||||
# see issue: https://github.com/rootzoll/raspiblitz/issues/681
|
# see issue: https://github.com/rootzoll/raspiblitz/issues/681
|
||||||
###################
|
###################
|
||||||
|
|
||||||
if [ "${command}" == "rotate" ]; then
|
elif [ "${command}" == "rotate" ]; then
|
||||||
|
|
||||||
# TURN ROTATE ON (the new default)
|
# TURN ROTATE ON (the new default)
|
||||||
if [ "$2" = "1" ] || [ "$2" = "on" ]; then
|
if [ "$2" = "1" ] || [ "$2" = "on" ]; then
|
||||||
@@ -44,7 +85,11 @@ if [ "${command}" == "rotate" ]; then
|
|||||||
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
|
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ${oldDrivers} -eq 1 ]; then
|
||||||
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
|
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
|
sudo sed -i "s/^lcdrotate=.*/lcdrotate=1/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
# delete possible touchscreen rotate
|
# delete possible touchscreen rotate
|
||||||
@@ -57,7 +102,11 @@ if [ "${command}" == "rotate" ]; then
|
|||||||
|
|
||||||
echo "#Turn OFF: LCD ROTATE"
|
echo "#Turn OFF: LCD ROTATE"
|
||||||
|
|
||||||
|
if [ ${oldDrivers} -eq 1 ]; then
|
||||||
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
|
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
|
sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
# if touchscreen is on
|
# if touchscreen is on
|
||||||
|
@@ -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
|
|
Reference in New Issue
Block a user