3

I have a laptop running linux with nvidia optimus/intel hybrid graphics where all outputs are connected to the intel card. It is driven by the i915 driver.

An external monitor or beamer is discovered only one time a boot cycle: If I disable or unplug it (and then plug it again), it cannot be enabled again, because the linux kernel does not detect it anymore: There are no udev or acpi events on plug/unplug and the sysfs, in my case /sys/class/drm/card0-DP-1/status, indicates that the output is disconnected. After a reboot the display is detected again, and again exactly one time. Suspending/hibernating and resuming suffice as well, but only if the output is uplugged while rebooting.

I think this is somehow related to the kernel probing/reprobing for output devices on boot. Can the kernel be somehow induced to re-probe for monitors, and thus to hopefully detect them again?

  • Is this under X? Just running xrandr (without --current) might be enough... Otherwise, I have an incantation to force-enable an output, but it's on a laptop at home. – derobert Apr 23 '18 at 17:58
  • 1
    This is in TTY as well, only worse: reenabling of TTY output on an external display seems randomly. But X should not have anything to do with the detection of the output as the kernel does not even detect it. @derobert: I would be grateful for the incantation! – jorsn Apr 23 '18 at 18:07
  • I'll grab it when I get home (sometime later tonight) ... but it's for X, not console. There are some i915 options that might help too (try /sbin/modinfo i915), but really this is supposed to work automatically :-( – derobert Apr 23 '18 at 19:03
  • I added the xrandr stuff, no idea if it is of any use. – derobert Apr 25 '18 at 22:16
5

This isn't the xrandr-approach the I know works in X, but for console you can try this — you can write to that /sys/class/drm/card0-DP-1/status file as well. I couldn't find proper documentation, but thankfully Linux is open source. Reviewing the source code, it looks like it takes a few values: detect, on, on-digital, and off.

So echo detect > /sys/class/drm/card0-DP-1/status should force a re-check for a monitor. Or echo on-digital > /sys/class/drm/card0-DP-1/status might manage to turn it on, regardless of what the detection thinks.

edit: Under X, I've used this to deal with HDMI that did not detect being plugged it — it'll force-enable the output. But unfortunately video only, HDMI audio won't work (and apparently isn't possible without a kernel patch):

xrandr --newmode "Mode 2" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
xrandr --addmode HDMI-1 "Mode 2"
xrandr --output HDMI-1 --mode "Mode 2" --right-of LVDS-1

All those numbers specify the video timings; normally it's auto-detected, the easiest way to get them is to grab the mode it's using when you've booted with it so it's working (xrandr --verbose will show them).

  • Force-enabling the monitor via sysfs/on worked, however, auto-detection (detect) did not. Thank you for the xrandr stuff, even if the modes were no problem as they were detected correctly after force-enabling. And thank you very much for the kernel-related part of the answer! – jorsn Apr 26 '18 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.