Command execution when HDMI or composite is detected
-
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).
./hdmi
does 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.
-
@matchaman Have you tried playing with the
tvservice
command to check if the HDMI is connected ? You could run thehdmi
script if the HDMI is on, or therca
script otherwise.$ tvservice -s [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
-
Thanks :)
It seems that
tvservice -s
outputs the info toegrep
so I simply addedthe following lines to rc.local beforeexit 0
if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI') ; then /home/pi/hdmi else /home/pi/rca fi
Simple and neat!
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.