RPI 4b dual monitor (gpredict gqrx) - jharwinbarrozo/rotcontrol GitHub Wiki

tvservice -l
this is to list all connected monitor or tv to the hdmi 0 and 1 port

for example if you connected two hdmi cable to the two hdmi port, this will be the output:
pi@raspberrypi:~ $ tvservice -l
2 attached device(s), display ID's are :
Display Number 2, type HDMI 0
Display Number 7, type HDMI 1
display number 2 is the id of the first monitor connected near the usb-c, 7 is the id of the second monitor connected to HDMI 1 (2nd port)

To find the EDID name for a specific display ID
tvservice -v <id> -n
is mentioned above

For example:
pi@raspberrypi:~ $ tvservice -v 2 -n
device_name=XXX-AAA
pi@raspberrypi:~ $ tvservice -v 7 -n
device_name=NEX-96VD

Configure /boot/config.txt so that every time pi4 detects this EDID name, it knows what settings they should be

First, plug the first display to the hdmi nearest to the usb-c power, then run tvservice -v 2 -n, note the name of the display

Enter the following commands to dump more detailed information from your monitor:
/opt/vc/bin/tvservice -d edid.dat; /opt/vc/bin/edidparser edid.dat
this is will create an edid.dat file in the directory /home/pi

  1. Take a look at the output/parsed information and see what's the best-preferred mode for the display
  2. Copy this edid.dat file to /boot and name it for example NEX-96VD.dat, we have to call this edid file into the config.txt
    sudo cp edid.dat /boot/NEX-96VD.dat
  3. Unplug the 1st display from hdmi nearest to the usb-c power, then connect the other display, run again tvservice -v 2 -n, and note the name of the display
  4. Dump and parse again.
  5. rename the edid.dat to for example XXX-AAA.dat, again, we have to call this edid file later

These new 2 .dat file you created inside /boot directory will be called by the config line:

hdmi_edid_file=1
hdmi_edid_filename:0=XXX-AAA.dat
hdmi_edid_filename:1=NEX-96VD.dat

[EDID=XXX-AAA]
hdmi_group=1
hdmi_mode=16
hdmi_drive=2

[EDID=NEX-96VD]
hdmi_group=2
hdmi_mode=39
hdmi_drive=1

NOTE: always plug the monitor to the right hdmi port, on this case, the XXX-AAA display should always be in the first hdmi (near the usb-s), and the NEX-96VD should be always plug to 2nd hdmi.