Is there an autostart script that will run if LE doesn't detect a monitor?

  • For various reasons, it takes my TV 15 seconds to turn on and LE thinks it is not connected to a monitor until that time. At the moment, I have to unplug the Pi4 and then reconnect when the TV turns on before starting the system or it won't come up. It's hugely annoying.

    Here is what it looks like when it works.

    Code
    HTPC1:~/.config # tvservice -s
    state 0x120009 [HDMI CEA (95) RGB lim 16:9], 3840x2160 @ 30.00Hz, progressive


    Is there a script that won't get blocked waiting for monitor discovery? Even better, is there a way to have it retry every few seconds until it finds something?

  • I'm pretty confident /storage/.config/autostart.sh does not run if no monitor is detected. If it did, I could take care of business with a script.

  • Here is what it looks like when it works.

    For various reasons, it takes my TV 15 seconds to turn on and LE thinks it is not connected to a monitor until that time. At the moment, I have to unplug the Pi4 and then reconnect when the TV turns on before starting the system or it won't come up. It's hugely annoying.

    Here is what it looks like when it works.

    Code
    HTPC1:~/.config # tvservice -s
    state 0x120009 [HDMI CEA (95) RGB lim 16:9], 3840x2160 @ 30.00Hz, progressive


    Is there a script that won't get blocked waiting for monitor discovery? Even better, is there a way to have it retry every few seconds until it finds something?

    Don't think there are ready made scripts but you can always create something...perhaps a while loop comes to mind..

    something like

    Code
    TVCHECK=$(tvservice -s && { echo "tvon" ; } || { echo "tvoff" ; }) 
    while [[ "$TVCHECK" == "tvoff" ]]; do
        TVCHECK=$(tvservice -s && { echo "tvon" ; } || { echo "tvoff" ; }) 
        if [[ "$TVCHECK" == "tvon" ]]; then
        break
        fi
        sleep 1
    done    

    Edited once, last by Mario77 (April 5, 2021 at 9:37 PM).

  • Thank you, Mario. That would be brilliant if there were a running process that could execute my script. I'm trying to find that process. This is the root of my question.

  • Thank you, Mario. That would be brilliant if there were a running process that could execute my script. I'm trying to find that process. This is the root of my question.

    You can always start script with autostart.sh..until while loop breaks and monitor is on startup will be paused as script loop will be running..not tested tough..that was just an idea..

    My advice = leave RPi on 24hrs


    Or have a look how to create EDID for Rpi..that might help

    Edited once, last by Mario77: Merged a post created by Mario77 into this post. (April 5, 2021 at 9:32 PM).

  • I can confirm that /storage/.config/autostart.sh does not run when the Pi is started before the TV is powered up.

    Is there a way to launch a script that is not blocked if LE doesn't find a monitor? Also, if LE is going to block on a no monitor event, how come it doesn't keep trying to discover a monitor every few seconds and then launch the platform if it discovers one?

  • I can confirm that /storage/.config/autostart.sh does not run when the Pi is started before the TV is powered up.

    Is there a way to launch a script that is not blocked if LE doesn't find a monitor? Also, if LE is going to block on a no monitor event, how come it doesn't keep trying to discover a monitor every few seconds and then launch the platform if it discovers one?

    You need to pass the monitor EDID file to your RPi...

    try this

    ssh

    Code
    /opt/vc/bin/tvservice -d /storage/edid.dat

    ssh

    Code
    #mount -o remount,rw /flash

    take the edid.dat from storage and place it in the flash directory

    then add this line to config.txt

    Code
    hdmi_edid_file=1

    ssh

    Code
    #mount -o remount,ro /flash

    restart

  • Yes.

    I also tried switching the HDMI cable to the other port, as well as creating an EDID file for both monitors.

    Please understand how much I appreciate the help. I've never dug this deep into LE so I'm ignorant of the details but it's nice to learn more about the system.

    Without this change, the screen stays black. With this change, it shows the LE version and hangs. So, it is one step closer to working.

    This is the bottom of the config.txt

  • I don t own a Rpi 4 yet but your issue might easily be an unsupported resolution the rpi is trying to change to on boot as no monitor is detected...can you try to whitelist some commonly used resolutions like 1920x1080 60hz in the video settings and try to reboot again

  • Da Flex no. The old hdmi_xxx config.txt options no longer have any effect on LE 10. We are finally using open source linux drivers (drm) now. drm.edid_firmware= and video= kernel command line options are the way to go now (like on all other linux systems).

    so long,

    Hias