[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Detecting whether HDMI is plugged in

I alighted on these links:
The former got a snotty reception there, but it suggested looking at /sys.

$ cat /sys/class/drm/card0/card0-HDMI-A-1/status

All well and good when the cable's connected. And if I pull the cable
and the kernel vomits the EDID into /var/log/kern.log¹, then

$ cat /sys/class/drm/card0/card0-HDMI-A-1/status

Replace the cable and remove again. If the kernel remains quiet,
the message stays at "connected" even though the cable is out.
When in X, typing   xrandr -q   appears to prod things so that
the status gets updated, but I want to be able to determine the
status outside X: now xrandr doesn't work of course as it can't
open the display.

What should I prod so that I get a reliable status before starting X?

¹ The dump seems to be the result of an error presumably caused by
the way in which the contacts break, leading to a checksum error:

[drm:drm_edid_block_valid [drm]] *ERROR* EDID checksum is invalid,
remainder is <N>

where <N> is a random positive integer probably ≤ 255.


Reply to: