I just bought a brand new Pi4 and official 7" touchscreen display along with case. I also have another existing Pi with HDMI monitor.
I'm running a custom image based on Raspbian Lite plus manually installed Xorg (so possibly missing some customisations from a full image?), and by default the screen is booting up 800x480 upside down, and then when X starts it goes to 640x480 upside down.
Putting the following lines in config.txt fixes both of these issues:
lcd_rotate=2 hdmi_group=2 hdmi_mode=87 hdmi_cvt=800 480 60 6 0 0 0 hdmi_drive=1
However this affects an HDMI display as well. I'm probably not going to have both the touchscreen and HDMI connected to the same Pi (though it'd be nice if I could, and these could be controlled independently), but I would like a single card that I can swap between a touchscreen-Pi and an HDMI-Pi that will use the correct resolutions for each without having to edit the configs in between.
With different HDMI monitors I could do this by using the
[EDID=x] filters in config.txt, but this doesn't seem to work for the touchscreen display:
$ tvservice -l 2 attached device(s), display ID's are : Display Number 0, type Main LCD Display Number 2, type HDMI 0 $ tvservice -n device_name=Ras-LCD Panel
But putting settings under
[EDID=Ras-LCD Panel] just makes them ignored at startup.
Is there some other config.txt filter that applies to the 7" display, or some other way to solve this?
If there isn't a way to do it in config.txt directly, then I'm ok with running some Linux script during boot to flip the screen (and touchscreen!) if the touchscreen is detected, if that's possible.