Skip to content

read-edid / parse-edid

Practical Gentoo-focused reference for using read-edid (get-edid / parse-edid) to discover EDID data, I²C buses, monitor capabilities, and generate Xorg monitor configuration files.


Install get-edid on Gentoo Linux

emerge --ask x11-misc/read-edid

Find wich binary files we get from x11-misc/read-edid package in Gentoo Linux

$ equery f x11-misc/read-edid | grep '^/usr/bin/'
/usr/bin/get-edid
/usr/bin/parse-edid

Read edid from default display via DDC

get-edid | parse-edid

Read edid from a specific I2C bus number 3

get-edid -b 3 | parse-edid

Dump raw edid binary to a file

get-edid > monitor.edid

Parse a the above saved edid binary

parse-edid < /sys/class/drm/card0-DP-1/edid

Show the I²C bus actually used by get-edid (first successfuledidread)

get-edid 2>&1 >/dev/null | sed -n 's/.*retrieved from i2c bus \([0-9]\+\).*/\1/p'

Extract only monitor vendor and model information

get-edid 2>/dev/null | parse-edid 2>/dev/null | grep -E '^[[:space:]]*(VendorName|ModelName)'

List supported resolutions and refresh rates

get-edid 2>/dev/null | parse-edid 2>/dev/null \
| grep -E '^[[:space:]]*(VendorName|ModelName)' \
| sed 's/^[[:space:]]*//'

Identify model name of the default bus

get-edid 2>/dev/null | parse-edid 2>/dev/null | grep -E '^\s*ModelName'|sed 's/\t//;s/"//g'

Identify model name for all our monitors

for b in $(get-edid 2>&1 >/dev/null | sed -n 's/^.*potential busses found: //p'); do
  get-edid -b "$b" 2>/dev/null \
  | parse-edid 2>/dev/null \
  | sed -n 's/^[[:space:]]*ModelName[[:space:]]*"\(.*\)"/i2c-'$b' ModelName \1/p'
done

Identify display name and preferred mode

get-edid 2>/dev/null | parse-edid 2>/dev/null \
| grep -E '^[[:space:]]*(Identifier|ModelName)' \
| sed 's/^[[:space:]]*//'

Check edid checksum validity

get-edid 2>/dev/null | hexdump -C | tail -n 1

Parallelize + only candidate buses (recommended)

get-edid 2>&1 >/dev/null \
| sed -n 's/^.*potential busses found: //p' \
| tr ' ' '\n' \
| xargs -r -P3 -I{} sh -c '
  echo "== i2c-$1 =="
  get-edid -b "$1" 2>/dev/null | parse-edid 2>/dev/null
' _ {}

Generate an xorg monitor section from edid

printf '%s\n' 0 3 5 \
| xargs -P3 -I{} sh -c '
  get-edid -b "$1" 2>/dev/null \
  | parse-edid 2>/dev/null \
  | awk -v b="$1" '"'"'BEGIN{print "== i2c-"b" =="}
    f{print}
    /^Section "Monitor"/{f=1; print}
    /^EndSection/{exit}
  '"'"'
' _ {}

Identify display name and preferred mode

get-edid 2>/dev/null | parse-edid 2>/dev/null | sed -n \
-e 's/^[[:space:]]*Identifier[[:space:]]*"\(.*\)"/Display: \1/p' \
-e 's/^[[:space:]]*ModelName[[:space:]]*"\(.*\)"/Model: \1/p' \
-e '/^[[:space:]]*Modeline[[:space:]]/ { s/^[[:space:]]*/Preferred candidate: /; p; q; }'

Buses

Show the potential buses we are using

get-edid 2>&1 >/dev/null | sed -n 's/^.*potential busses found: //p'

Find EDID-capable I²C buses using get-edid candidate scan (fast)

get-edid 2>&1 >/dev/null \
| sed -n 's/^.*potential busses found: //p' \
| tr ' ' '\n' \
| xargs -r -P3 -I{} sh -c 'get-edid -b "$1" >/dev/null 2>&1 && echo "edid OK on i2c-$1"' _ {}

Probe all I²C buses for edid (slow if many adapters timeout - same as above output)

printf '%s\n' /dev/i2c-* \
| sed 's#.*/i2c-##' \
| xargs -P3 -I{} sh -c 'get-edid -b "$1" >/dev/null 2>&1 && echo "edid OK on i2c-$1"' _ {}

Probe all /dev/i2c-* for get bus id (brute-force, slower)

printf '%s\n' /dev/i2c-* \
| sed 's#.*/i2c-##' \
| xargs -P3 -I{} sh -c 'get-edid -b "$1" >/dev/null 2>&1 && echo "edid OK on i2c-$1"' _ {}

Find active edid I²C buses using candidate pre-scan (fastest method)

get-edid 2>&1 >/dev/null \
| sed -n 's/^.*potential busses found: //p' \
| tr ' ' '\n' \
| xargs -r -P3 -I{} sh -c 'get-edid -b "$1" >/dev/null 2>&1 && echo "$1"' _ {}

List candidate I²C buses detected by get-edid (single scan, fastest)

get-edid 2>&1 >/dev/null | sed -n 's/^.*potential busses found: //p'    

List candidate I²C buses detected by get-edid (single scan, fastest)

get-edid 2>&1 >/dev/null | sed -n 's/^.*potential busses found: //p'

Check edid checksum validity

get-edid 2>/dev/null | hexdump -C | tail -n 1

Fully decode EDID including CEA modes (recommended)

get-edid 2>/dev/null | edid-decode

Create files for xorg.conf.d

Show full information of our monitors

printf '%s\n' 0 3 5 \
        | xargs -P3 -I{} sh -c '
          get-edid -b "$1" 2>/dev/null \
          | parse-edid 2>/dev/null \
          | awk -v b="$1" '"'"'BEGIN{print "== i2c-"b" =="}
            f{print}
            /^Section "Monitor"/{f=1; print}
            /^EndSection/{exit}
          '"'"'
        ' _ {}

This is how to create a simple 10-monitor.conf in /etc/X11/xorg.conf.d/10-monitor.conf (This is for: HP EliteDesk 800 G3 DM 65W)

cat << "EOF" > /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
    Identifier "LEN LT2452pwC"
    Option "DPMS" "true"
EndSection

Section "Monitor"
    Identifier "VX3211-4K"
    Option "DPMS" "true"
EndSection

Section "Monitor"
    Identifier "L27e-30"
    Option "DPMS" "true"
EndSection
EOF
  • Make sure it´s executable and owned by my own user
chown wuseman:wuseman /home/wuseman/.xprofile
chmod +x /home/wuseman/.xprofile

Check whether we using /etc/x11/xorg.conf.d or not

grep -iE "Using config|xorg.conf.d" /var/log/Xorg.0.log

Decode and display monitor EDID information

pedid-decode /sys/class/drm/card0-DP-3/edid

Show DRM connector ID

cat /sys/class/drm/card0-DP-1/connector_id

Show DPMS (power management) state

cat /sys/class/drm/card0-DP-1/dpms

Check whether the connector is enabled

cat /sys/class/drm/card0-DP-1/enabled

Show current connector status

cat /sys/class/drm/card0-DP-1/status