[Help] How to fake a connected monitor during boot time?

Hi,

I have 2 miniPCs, one connected to a TV and the other connected to a monitor via a KVM switch; both PCs are running EndeavourOS. I am trying to setup both systems so that booting up the PCs will always work. I mean, currently if I boot up the PC while I am watching live TV for a while, I get a blank screen when I switch to the PC,

I want to see the lightdm greeter whether the monitor is connected or not when booting. I know this is possible because I have done it with Custom EDID on LibreElec wiki.

I am able to login via a virtual terminal to run

$ grep connected /sys/class/drm/*/status
/sys/class/drm/card0-HDMI-A-1/status:disconnected
/sys/class/drm/card0-HDMI-A-2/status:disconnected

After much research, I thought I know how to fix this. But no joy. Anyway, this is what I have done:

Turned on the TV, switched the input to the PC and turn it on. Similarly, ensure the KVM is switched to the PC before turning it on. Doing this properly, I get the login screen.

Run the above grep command, The card0-HDMI-A-1 port is now connected. I extracted the TV’s EDID or the monitor’s EDID with

$ cp /sys/class/drm/card0-HDMI-A-1/edid /tmp/philips_edid.bin
$ di-edid-decode < /tmp/philips_edid.bin
$ parse-edid < /tmp/philips_edid.bin

Looking at the “Manufacturer”, “Vendor”, “Model” fields in the outputs of di-edid-decode and parse-edid, I believe the EDID data is correct. That is, the KVM switch did not inject its own EDID.

Then I copied the EDID to the system folder.

$ sudo mkdir /usr/lib/firmware/edid
$ sudo cp /tmp/philips_edid.bin /usr/lib/firmware/edid/

Next, I added the kernel option:

$ x=$(cat /etc/kernel/cmdline)
$ echo -n "$x drm.edid_firmware=HDMI-1:edid/philips_edid.bin" > /tmp/cmdline
$ sudo cp /tmp/cmdline /etc/kernel/cmdline

I used echo -n because I wanted to leave /etc/kernel/cmdline as

$ file /etc/kernel/cmdline
/etc/kernel/cmdline: ASCII text, with very long lines (436), with no line terminators

I left out the HDMI-1: string in my first attempt. In my 2nd attempt I added card0-HDMI-A-1: because I thought I need to inform the kernel that the monitor is (or will eventually be) physically connected to this port. I thought the entry name in /sys/class/drm/ should be used as the namespace. In the 3rd attempt after I have browsed through /var/log/Xorg.0.log, I changed card0-HDMI-A-1: to the final HDMI-1: form.

Finally, I ran

$ sudo reinstall-kernels
$ sudo grep options /efi/loader/entries/45dbd12239034d3a9af76bf1ed4f79e4-6.12.17-1-lts.conf
$ sudo /sbin/reboot

I used the grep command to confirm that the system will boot up with the drm.edid_firmware=... option.

Immediately after hitting the reboot command, I switched away from the PC and waited about 1 to 2 minutes before switching back to the PC. Alas, I still get the blank screen.

At this stage, I thought I need to carry out “early kernel mode setting” and put the EDID file in the initramfs,

$ sudo su
# echo "install_items+=\" /usr/lib/firmware/edid/philips_edid.bin \"" > /etc/dracut.conf.d/edid.conf
# reinstall-kernels
# lsinitrd /efi/45dbd12239034d3a9af76bf1ed4f79e4/6.12.17-1-lts/initrd | grep edid
# /sbin/reboot

The lsinitrd command confirms that usr/lib/firmware/edid/philips_edid.bin (without the leading “/”) is in all images in the system.

No joy: I see a blank screen after I switched the KVM to the PC. In each attempt, I checked with dmesg and journalctl -b. I see that the command line contains the drm.edid_firmware flag. I think I would see the login screen if the message

[drm] Got built-in EDID base block and 0 extensions from "edid/philips_edid.bin" for connector "HDMA-1"

appears in dmesg; it would mean the kernel has loaded the EDID file even though no monitor is connected on either ports. I do not see this text. But I do see

$ sudo journalctl -b
Mar 06 16:59:55 neo kernel: i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/adlp_dmc.bin (v2.20)
Mar 06 16:59:55 neo kernel: i915 0000:00:02.0: [drm] GT0: GuC firmware i915/adlp_guc_70.bin version 70.36.0
Mar 06 16:59:55 neo kernel: i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3

which makes me wonder if I have wrongly written the drm.edid_firmware=HDMI-1:edid/philips_edid.bin option. Also, does i915 in the above drm messages refer to the GPU?

If I boot up the PC without the monitor, /var/log/Xorg.0.log contains the messages

$ cat /var/log/Xorg.0.log
...
[     5.760] (II) modeset(0): EDID for output HDMI-1
[     5.770] (II) modeset(0): EDID for output HDMI-2
[     5.770] (II) modeset(0): Output HDMI-1 disconnected
[     5.770] (II) modeset(0): Output HDMI-2 disconnected
[     5.770] (WW) modeset(0): No outputs definitely connected, trying again...
[     5.770] (II) modeset(0): Output HDMI-1 disconnected
[     5.770] (II) modeset(0): Output HDMI-2 disconnected
[     5.770] (WW) modeset(0): Unable to find connected outputs - setting 1024x768 initial framebuffer
...

Later, after I switched the monitor to the PC, the following messages appear:

...
[   243.204] (II) modeset(0): EDID vendor "PFT", prod id 16386
[   243.204] (II) modeset(0): Using EDID range info for horizontal sync
[   243.204] (II) modeset(0): Using EDID range info for vertical refresh
[   243.204] (II) modeset(0): Printing DDC gathered Modelines:
...
[   244.838] (**) Barcode Reader : Applying InputClass "libinput keyboard catchall"
[   244.838] (**) Barcode Reader : Applying InputClass "system-keyboard"
...
[   249.041] (**) Logitech Wireless Mouse: Applying InputClass "devname"
[   249.041] (**) Logitech Wireless Mouse: Applying InputClass "system-keyboard"
...

which show that the KVM is transferring the video, keyboard, and mouse devices to the PC.

The dmesg messages around the same time are

$ sudo dmesg
...
[  243.154122] fbcon: i915drmfb (fb0) is primary device
[  243.154183] Console: switching to colour frame buffer device 240x67
[  243.154188] i915 0000:00:02.0: [drm] fb0: i915drmfb frame buffer device
...
[  243.654580] usb 3-5.1: Product: Barcode Reader 
...
[  244.038097] usb 3-5.2: Product: USB Receiver
[  244.038103] usb 3-5.2: Manufacturer: Logitech
...

The /var/log/Xorg.0.log and dmesg messages are promising. They show that the kernel and X11 can detect changes. The question now is how to reset /sys/class/drm/card0-HDMI-A-1/status and restart the X server?

I would be grateful if someone can review my steps and tell me where I have went wrong. Is there anything specific to EndeavourOS that needs to be done in order for the kernel to use the EDID file for the HDMI-1 port even though it is not connected? Thank you.

let the kvm switch be your secondary monitor source

How can I do this? I don’t think I can configure my KVM.
Furthermore, how about my other situation? There is no KVM device between the PC and TV.

Would something like this work?

Let me rephrase my request.

I want to boot my EOS system without a monitor when it is turned on. At a later time when I connect the monitor, I would like to see the login screen.

For the PC connected to the TV, I have configured it to autologin into a Kodi session. Oftentimes I turn on the PC before turning on the TV and see a blank screen later on. Previously I had LibreELEC running on that PC. I had the blank screen problem until I ran a shell script that implements early kernel mode setting with the TV’s EDID. That script is specific to LibreELEC. I have migrated that PC from LE to EOS and now I am trying to do something similar on EOS.

1 Like

Thanks, a lot clearer, but I have no idea, never had to deal with that situation.