]> mj.ucw.cz Git - edid.git/blob - edid-drm
edid-drm: Handle monitors in stand-by mode
[edid.git] / edid-drm
1 #!/bin/sh
2 # Scan all output of all video cards known to Linux Direct Rendering Manager
3 # and identify connected displays.
4
5 set -e
6 exit_code=0
7 for a in /sys/class/drm/card*-* ; do
8         if [ -f $a/edid ] ; then
9                 # This is tricky: for disconnected outputs, the edid file exists,
10                 # but it is empty. Monitors in stand-by mode have the "enabled"
11                 # attribute set to "disabled", but the edid file is still valid.
12                 # Since the file is purely virtual, we need to copy it first.
13                 x=$(mktemp)
14                 cp $a/edid $x
15                 if [ -s $x ] ; then
16                         echo "### $(basename $a) ###"
17                         echo
18                         edid <$x || exit_code=1
19                         echo
20                 fi
21                 rm -f $x
22         fi
23 done
24 exit $exit_code