tool: add a tool for dumping EDID/DisplayID from I2C

Dumps the content of every I2C address which might contain an EDID or
DisplayID blob for every connector which has an I2C bus.

This can be useful to discover DisplayID blobs which are not nested
inside an EDID blob.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2023-05-05 12:53:02 +02:00 committed by Simon Ser
parent 5c9801a75f
commit 8781d1d7a9

36
tool/dump-i2c.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/sh -eu
if ! lsmod | grep i2c_dev &>/dev/null; then
echo "kernel module i2c-dev must be loaded"
exit
fi
if ! command -v i2cdump &>/dev/null; then
echo "i2cdump from i2c-tools must be installed"
exit
fi
for connector in $(find /sys/class/drm/ -maxdepth 1 -name 'card[0-9]-*'); do
bus=$(find "$connector/" -maxdepth 1 -mindepth 1 -type d -name 'i2c-*' -print -quit | sed -n 's/.*\/i2c\-\(.*\)/\1/p')
if [ "$bus" = "" ]; then
bus=$(find "$connector/ddc/i2c-dev/" -maxdepth 1 -mindepth 1 -type d -name 'i2c-*' -print -quit | sed -n 's/.*\/i2c\-\(.*\)/\1/p')
fi
if [ "$bus" = "" ]; then
echo "Connector $(basename $connector) does not have an i2c bus. Skipping."
continue
fi
echo "Dumping connector $(basename $connector) i2c bus address 0x50"
i2cdump -y $bus 0x50 b
echo "Dumping connector $(basename $connector) i2c bus address 0x51"
i2cdump -y $bus 0x51 b
echo "Dumping connector $(basename $connector) i2c bus address 0x54"
i2cdump -y $bus 0x54 b
echo "Dumping connector $(basename $connector) i2c bus address 0x55"
i2cdump -y $bus 0x55 b
done