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.
References: (a) Waveshare toggle between_LCD_and_HDMI_display https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)#Toggle_between_LCD_and_HDMI_display
(b) Artillery [ILI9341] 3.2" LCD Touch Screen White Display and Driver Problem
https://raspberrypi.stackexchange.com/questions/104600/artillery-ili9341-3-2-lcd-touch-screen-white-display-and-driver-problem. Cheers.
– tlfong01 Feb 03 '20 at 02:54