Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    How check if the HDMI is plugged in Shell Script ?

    Recalbox General
    read config.txt
    2
    4
    1448
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Israel Neves
      Israel Neves last edited by Israel Neves

      How check if the HDMI is plugged in Shell Script ?

      Substring 1 Reply Last reply Reply Quote 0
      • Substring
        Substring @Israel Neves last edited by

        @israel-neves Check the tvservice command

        Former dev - Please reply with @substring so that i am notified when you answer me
        Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

        1 Reply Last reply Reply Quote 0
        • Israel Neves
          Israel Neves last edited by

          i build a 3.5 tft with recalbox, the thing is, the tvservice -s with HDMI plugged and not, gives the same answer

          1 Reply Last reply Reply Quote 0
          • Israel Neves
            Israel Neves last edited by acris

            Here the script that i want to run with S99custom

            #!/bin/bash
            
            
            IFS='  ' read -r -a array <<< "$(tvservice -s)"   # THIS LINE ! tvservice -s give the same answer with or without HDMI plug
            echo "${array[1]}"
            if [ "${array[1]}" == "0x12000a" ]; then
            	echo "Sem HDMI"
            	if [ "$(cat /boot/tela.txt)" == "hdmi" ]; then
            		echo "Sem HDMI e setado como HDMI, setando como LCD"
            		mount -o remount, rw /boot
            		mount -o remount, rw /
            		cp /boot/configLcd.txt /boot/config.txt
            		echo "lcd" > /boot/tela.txt
            		sh ./recalbox/scripts/recalbox-save-overlay.sh
            		reboot
            	else
            		echo "Sem HDMI, tela setada como LCD"
            		start-stop-daemon -S -q -m -b -p /var/run/fbcp.pid --exec /usr/bin/fbcp -- -n
            	fi
            	else
            		echo "HDMI Conectado"
            		if [ "$(cat /boot/tela.txt)" == "lcd" ]; then
            			echo "Sem HDMI e setado como HDMI, setando como LCD"
            		mount -o remount, rw /boot
            		mount -o remount, rw /
            		cp /boot/configHdmi.txt /boot/config.txt
            		echo "hdmi" > /boot/tela.txt
            		sh ./recalbox/scripts/recalbox-save-overlay.sh
            		reboot
            		fi
            fi
            
            test -e "/recalbox/share/system/custom.sh" && /recalbox/share/system/custom.sh $1
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            Want to support us ?

            70
            Online

            99.6k
            Users

            28.1k
            Topics

            187.1k
            Posts

            Copyright © 2021 recalbox.com