Friday, December 15, 2017

Ubuntu 17.10 and losing my EDID on a vga splitter


So I got a new 50 inch tv and I thought it'd be great to use it as a monitor. Getting a VGA splitter device allows me to hook up my 24 inch monitor and pipe the output into the TV's VGA input.

It looks great, but after rebooting, I discovered that I had lost the ability to read the monitor's EDID info so ubuntu gives me a 1024x768 display instead of the 1920x1080 display.

After reading a whole bunch of pages with suggestions and tips, here's what worked for me:

First get the read-edid with "sudo apt-get install read-edid"


I read the EDID info with just my original hannsg 24 connected and wrote that to a file.

sudo get-edid -b 1 > hannsg.bin

The -b is the bus number. As I have dual monitors, I had to figure out which bus it was on. One of my missteps was getting the edid for my other monitor (which tops out at 1280x1024) accidentally, hence manually specifying the bus number.

To make sure you've got the right monitor, pipe it to parse-edid:

cat hannsg.bin | parse-edid

and that should tell you that you've got the right monitor.

now you want to copy that file into /lib/firmware/edid

sudo mkdir /lib/firmware/edid
sudo cp hannsg.bin /lib/firwmare/edid/hannsg.bin


now I edit my ubuntu grub booting configuration:

sudo nano /etc/default/grub



There are built-in edid for common resolutions but this will only get you that one specific resolution:
You can try specifying a specific resolution like so:

GRUB_CMDLINE_LINUX_DEFAULT="drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin"
GRUB_CMDLINE_LINUX="drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin"


I have changed the HIDDEN_TIMEOUT to 5 seconds so I have time to hit esc to get the GRUB menu after a reboot and also so you can edit the command line in grub with "e" (and CTRL+X to edit the grub boot editor). It's pretty useful to have the grub boot editor if you just want to test a specific command line settings without making permanent changes).

===============================

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=5
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin"
GRUB_CMDLINE_LINUX="drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin"


========================================

the important lines here are the ones with the drm_kms_helper

GRUB_CMDLINE_LINUX_DEFAULT="drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin"
GRUB_CMDLINE_LINUX="drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin"


This is what the original section of /etc/default/grub looked like:

==================================================
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

=======================================================

Once you make your edits and save, then

sudo update-grub


So now after boot I get this when I check my dmesg:


dmesg | grep edid
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.13.0-19-generic root=UUID= ro drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.13.0-19-generic root=UUID= ro drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin drm_kms_helper.edid_firmware=VGA-1:edid/1920x1080.bin
[ 2.521260] [drm] Got built-in EDID base block and 0 extensions from "edid/1920x1080.bin" for connector "VGA-1"
[ 34.742536] [drm] Got built-in EDID base block and 0 extensions from "edid/1920x1080.bin" for connector "VGA-1"
[ 57.856240] [drm] Got built-in EDID base block and 0 extensions from "edid/1920x1080.bin" for connector "VGA-1"




dmesg | grep edid
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.13.0-19-generic root=UUID= ro drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.13.0-19-generic root=UUID= ro drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin drm_kms_helper.edid_firmware=VGA-1:edid/hannsg.bin
[ 2.445432] platform VGA-1: Direct firmware load for edid/hannsg.bin failed with error -2
[ 2.445470] [drm:drm_load_edid_firmware [drm_kms_helper]] *ERROR* Requesting EDID firmware "edid/hannsg.bin" failed (err=-2)
[ 33.654278] [drm] Got external EDID base block and 0 extensions from "edid/hannsg.bin" for connector "VGA-1"
[ 63.689153] [drm] Got external EDID base block and 0 extensions from "edid/hannsg.bin" for connector "VGA-1"


And a couple of notes:

I have specified a connector name with "VGA-1:" so it gets that edid for that particular connector.

You can get the connector names by looking at /sys/class/drm

ls /sys/class/drm/
card0 card0-DP-1 card0-HDMI-A-1 card0-VGA-1 renderD128 version

Also I had problems because I didn't put the edid in the correct directory. One webpage I looked at said /usr/lib/firmware/edid which didn't work for me: I had to put it in /lib/firmware/edid. After I did that I was golden.

Before that I was getting these strange error -2 couldn't load the edid/hannsg.bin messages in my dmesg log. I do get an error -2 but it keeps retrying and finds it once it mounts the filesystem I think.

Doing a "dmesg | grep mount" tells me that my file system isn't mounted until 3.1 seconds mark so that's probably what's happening.

[ 3.137360] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 9.739364] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro



Now I can hook up my vga splitter box and it happily loads the proper edid and everything is right with the world.


I must've rebooted about 20-30 times to get this working. I found this process most difficult so I hope this helps you avoid the same frustration!

It'd be really cool to just have a "choose custom resolution" button in the display settings where you could enter "1920x1080x60" for example when it can't get a proper edid. That would be too easy, I guess 8-)





Another thing you can try is this from a terminal:

echo "VGA-1:edid/hannsg.bin" | sudo tee /sys/module/drm_kms_helper/parameters/edid_firmware

(you need the tee even when you've done the sudo because it's the shell that does the redirection)

echo "VGA-1:edid/hannsg.bin" > /sys/module/drm_kms_helper/parameters/edid_firmware
bash: /sys/module/drm_kms_helper/parameters/edid_firmware: Permission denied


If you have specified a value for this, then you see the value that you've set:

cat /sys/module/drm_kms_helper/parameters/edid_firmware
VGA-1:edid/hannsg.bin


No comments:

Post a Comment