Hi all,
This here is not so much a genius invention, as it just is a solution to a problem I was facing for a while now. Since now I have a simple & easy solution, I thought I'd share. There simply isn't much documentation yet for dual screen setups on the new Rpi4.
My wish
I run a small media player that during the day plays music, and displays tracks on a small 7 inch display connected to hdmi port 1 & is built into a case. In the evenings, if I'd like to watch Netflix or a movie, it is connected to a projector on hdmi port 0. So far, I always had difficulty switching displays without physically changing ports and resolutions in the config.txt.
My solution (given that my system's built in display already worked)
1. SSH in and make sure your config file can be edited using the following command:
2. make a copy of the config file using:
3. open the config1.txt like so:
4. edit the config1 file so that it works with the projector. Obviously test this yourself to confirm it working. For me I added the following:
#forcing the Pi to ignore port 1 (built-in)
hdmi_ignore_hotplug:1=1
#forcing the Pi to use port 0 (projector)
hdmi_force_hotplug:0=1
#setting all settings to match my projector
max_usb_current:0=1
hdmi_ignore_edid:0=0xa5000080
hdmi_group:0=2
hdmi_mode:0=82
hdmi_cvt:0=1920 1080 60 6 0 0 0
hdmi_drive:0=1
hdmi_ignore_cec_init:0=1
Display More
5. config.txt is already confirmed working with the built-in display and looks like this:
#forcing the Pi to ignore port 0 (projector)
hdmi_ignore_hotplug:0=1
#forcing the Pi to use port 1 (built-in)
hdmi_force_hotplug:1=1
#setting all settings to match my built-in display
max_usb_current:1=1
hdmi_ignore_edid:1=0xa5000080
hdmi_group:1=2
hdmi_mode:1=87
hdmi_cvt:1=1024 600 60 6 0 0 0
hdmi_drive:1=1
hdmi_ignore_cec_init:1=1
Display More
6. finally rename config1.txt to config.dat to render it "inactive":
Now we need something to switch the config files automatically. I used plink to switch config files by simply renaming them config.dat <> config.txt. If i move the naming back and forth, the display is switched after a reboot.
1. On the PC i created a .bat file with the following command:
2. The configswitch.txt is a file saved at the patch described in step 1. It contains instructions to rename the files as follows:
mount -o remount,rw /flash
cd ..
cd /flash
mv config.txt config1.dat
mv config.dat config.txt
mv config1.dat config.dat
cd ..
mount -o remount,ro /flash
reboot
It changes the file permissions to allow writing. Then navigates to the folder and renames the files so they end up switched around. Afterwards I make the files read-only again. Finally the system reboots.
3. Save the .txt and .bat file & use the .bat to switch & reboot whenever you want.
Et voila! a simple and crude way to switch displays at the click of one button! I know this is not how LibreELEC is supposed to work, but because I was lacking means to find another solutions, this works pretty well!
EDIT: some errors in the config upon creating this post