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.
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)
- #forcing the Pi to use port 0 (projector)
- #setting all settings to match my projector
- hdmi_cvt:0=1920 1080 60 6 0 0 0
5. config.txt is already confirmed working with the built-in display and looks like this:
- #forcing the Pi to ignore port 0 (projector)
- #forcing the Pi to use port 1 (built-in)
- #setting all settings to match my built-in display
- hdmi_cvt:1=1024 600 60 6 0 0 0
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:
- plink [email protected] -pw password -m C:\Users\"my username"\configswitch.txt
2. The configswitch.txt is a file saved at the patch described in step 1. It contains instructions to rename the files as follows:
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