RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Command execution when HDMI or composite is detected

    Scheduled Pinned Locked Moved Help and Support
    compositercahdmiswitchport
    3 Posts 2 Posters 1.2k Views
    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.
    • matchamanM
      matchaman
      last edited by matchaman

      I have two script files, called hdmi and rca. They're basically doing a dirty job for preparing my setup for HDMI and composite (CRT TV).

      ./hdmidoes the following:

      #!/bin/bash
      mv /opt/retropie/configs/all/{videomodes.cfg,videomodes1.cfg}
      mv /opt/retropie/configs/all/retroarch/shaders/shaders/{crt-pi1.glsl,crt-pi.glsl}
      

      And ./rca is this:

      #!/bin/bash
      mv /opt/retropie/configs/all/{videomodes1.cfg,videomodes.cfg}
      mv /opt/retropie/configs/all/retroarch/shaders/shaders/{crt-pi.glsl,crt-pi1.glsl}
      

      Videomodes.cfg contains 240p signal settings which is a no-no for HDTVs while renaming crt-pi results in easily switching on/off my default shader that looks terrible on a CRT TV.

      I'm pretty happy with those but I have to run each script everytime I switch cables. Any solution for them to be executed on boot when each output is detected? Thanks in advance.

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @matchaman
        last edited by

        @matchaman Have you tried playing with the tvservice command to check if the HDMI is connected ? You could run the hdmi script if the HDMI is on, or the rca script otherwise.

        $ tvservice -s
        [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
        
        1 Reply Last reply Reply Quote 1
        • matchamanM
          matchaman
          last edited by matchaman

          Thanks :)

          It seems that tvservice -s outputs the info to egrep so I simply addedthe following lines to rc.local before exit 0

          if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI') ; then
          /home/pi/hdmi
          else
          /home/pi/rca
          fi
          

          Simple and neat!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.