From: Martin Mares Date: Tue, 16 Apr 2024 14:26:12 +0000 (+0200) Subject: edid-drm: Handle monitors in stand-by mode X-Git-Tag: v1.2~1 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=0da45161507ce0f944834483972234ab41c3ea2d;p=edid.git edid-drm: Handle monitors in stand-by mode --- diff --git a/edid-drm b/edid-drm index abe755d..5e1bb90 100755 --- a/edid-drm +++ b/edid-drm @@ -1,10 +1,24 @@ #!/bin/sh +# Scan all output of all video cards known to Linux Direct Rendering Manager +# and identify connected displays. + set -e +exit_code=0 for a in /sys/class/drm/card*-* ; do - if [ -f $a/edid -a "$(cat 2>/dev/null $a/enabled)" = enabled ] ; then - echo "### $(basename $a) ###" - echo - $(dirname $0)/edid <$a/edid - echo + if [ -f $a/edid ] ; then + # This is tricky: for disconnected outputs, the edid file exists, + # but it is empty. Monitors in stand-by mode have the "enabled" + # attribute set to "disabled", but the edid file is still valid. + # Since the file is purely virtual, we need to copy it first. + x=$(mktemp) + cp $a/edid $x + if [ -s $x ] ; then + echo "### $(basename $a) ###" + echo + edid <$x || exit_code=1 + echo + fi + rm -f $x fi done +exit $exit_code