#767 HDMI switching

This commit is contained in:
rootzoll 2020-01-24 21:46:51 +01:00
parent bc86b11611
commit 0adfedfe25
4 changed files with 38 additions and 4 deletions

View File

@ -89,6 +89,7 @@ else
echo "network=${network}" >> $configFile
echo "chain=${chain}" >> $configFile
echo "hostname=${hostname}" >> $configFile
echo "lcd2hdmi=${lcd2hdmi}" >> $configFile
# try to determine publicIP and if not possible use localIP as placeholder
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101

View File

@ -39,6 +39,7 @@ network=""
chain=""
setupStep=0
fsexpanded=0
lcd2hdmi="off"
# try to load old values if available (overwrites defaults)
source ${infoFile} 2>/dev/null
@ -50,6 +51,7 @@ echo "message=" >> $infoFile
echo "network=${network}" >> $infoFile
echo "chain=${chain}" >> $infoFile
echo "fsexpanded=${fsexpanded}" >> $infoFile
echo "lcd2hdmi=${lcd2hdmi}" >> $infoFile
echo "setupStep=${setupStep}" >> $infoFile
if [ "${setupStep}" != "100" ]; then
echo "hostname=${hostname}" >> $infoFile
@ -138,6 +140,22 @@ if [ ${afterSetupScriptExists} -eq 1 ]; then
sleep 100
fi
################################
# FORCED SWITCH TO HDMI
# if a file called 'hdmi' gets
# placed onto the boot part of
# the sd card - switch to hdmi
################################
forceHDMIoutput=$(sudo ls /boot/hdmi 2>/dev/null | grep -c hdmi)
if [ ${forceHDMIoutput} -eq 1 ]; then
# delete that file (to prevent loop)
sudo rm /boot/hdmi
# switch to HDMI what will trigger reboot
sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on
exit 0
fi
################################
# WAIT FOR LOCAL NETWORK
################################

View File

@ -30,6 +30,18 @@ function repair() {
./98repairMenu.sh
}
# command: hdmi
function hdmi() {
echo "# SWITCHING VIDEO OUTPUT TO --> HDMI"
/home/admin/config.scripts/blitz.lcd.sh hdmi on
}
# command: lcd
function lcd() {
echo "# SWITCHING VIDEO OUTPUT TO --> LCD"
/home/admin/config.scripts/blitz.lcd.sh hdmi off
}
# command: manage
function manage() {
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null | grep -c "lndmanage=on") -eq 1 ]; then

View File

@ -170,17 +170,20 @@ fi
if [ "${command}" == "hdmi" ]; then
# make sure that the config entry exists
if [ ${#lcd2hdmi} -eq 0 ]; then
echo "lcd2hdmi=off" >> /mnt/hdd/raspiblitz.conf
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null| grep -c 'lcd2hdmi=') -eq 0 ]; then
echo "lcd2hdmi=off" >> /mnt/hdd/raspiblitz.conf 2>/dev/null
fi
secondParameter=$2
if [ "${secondParameter}" == "on" ]; then
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=on/g' /mnt/hdd/raspiblitz.conf
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=on/g' /home/admin/raspiblitz.info 2>/dev/null
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=on/g' /mnt/hdd/raspiblitz.conf 2>/dev/null
cd /home/admin/LCD-show
./LCD-hdmi
elif [ "${secondParameter}" == "off" ]; then
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=off/g' /mnt/hdd/raspiblitz.conf
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=off/g' /home/admin/raspiblitz.info 2>/dev/null
sudo sed -i 's/^lcd2hdmi=.*/lcd2hdmi=off/g' /mnt/hdd/raspiblitz.conf 2>/dev/null
cd /home/admin/LCD-show
./LCD35-show
else