A rPi3 B+ is Raspbian configured with a 3.5 Waveshare touch display HAT.
There are two commands that toggle between the HDMI output and the HDMI output.
git clone https://github.com/waveshare/LCD-show.git cd LCD-show ./LCD35-show #reboots device and directs video to LCD ./LCD-hdmi #reboots device and directs video to HDMI port
The desired boot algorithm \ script is:
if LCD is detected if LCD-hdmi flag is true (Video currently configured for HDMI) set LCD-hdmi flag false set LCD35-show flag true execute ./LCD35-show #reboot with LCD Driver else if LCD is not Detected if LCD35-show flag is true (Video currently configure LCD display) set LCD35-show flag false set LCD-hdmi flag true execute ./LCD-hdmi #reboot with HDMI driver
flags must be persistent (survive reboots).
How can the display be detected from the command line? Bonus round: complete the script.