I would like to be able to switch my Pi between several different physical monitors that I have (one at a time). The screens are not all the same type or resolution.
For most of the monitors, the Pi's autodetection works fine and it displays at the "right" resolution with nothing specified in config.txt.
However for some of them I need to explicitly specify hdmi_mode
or similar in config.txt to get it to display at the correct resolution. Unfortunately, this means that I need to edit config.txt every time that I want to switch between these screens.
Is there any way of avoiding this? Can I somehow get it to detect a specific brand/model of monitor (via EDID, presumably) but then go to a specific mode that I choose for that monitor instead of what it wants to do by default -- while still behaving normally for other monitors? Ideally right from boot, but it's probably ok if a boot script can change the resolution in flight.
I'm ok with modifying code to do this, if someone can point me at the program that would have to be changed.
tvservice
andawk
I've come up with something that seems to do the trick (it's ugly, but I'll post it if there's interest). But a remaining issue is that one of the monitors also needs an hdmi_cvt custom mode. I can still handle that via config.txt as long as there's only one of them, but if I ever get a second monitor that needs a different custom mode then I'll have a problem. Is there a way to emulate hdmi_cvt viatvservice
as well? I couldn't see anything.