Gentoo and Displaylink

Introduction

I have a HP laptop that I’ve installed Gentoo on. However, the only HDMI port on it appears to be connected to the onboard NVIDIA card or some other strange arrangement. Everyone knows how well Linux and NVIDIA work together, so I’ve given up on getting it to work. But I wanted more monitors for my laptop, so I decided to get a Dell dock. For work, I have an Ubuntu Linux laptop which uses a Dell dock quite nicely, so I knew it was at least possible. So I decided to pick up a Dell docker open box from Best Buy. I looked around and picked out an open-box Dell D3100 dock.

Getting the Dock

When I got it, I started by looking at the wiki page for DisplayLink, the protocol the dock says it uses to provide the displays over USB. I reconfigure my kernel to have those features enabled and reboot…. it doesn’t work. Turns out, (not specifically mentioned, but can be implied) the Gentoo wiki is talking about DisplayLink 2.0, which runs on USB 2.0 devices. The dock I got uses USB 3 and DisplayLink 3.0. With some research, I soon find out I need to install a new kernel module and management software. However, the installer is only built for Ubuntu. Given I’m using Gentoo with openrc instead of systemd, I had to adapt the contents of the installer to my use. At least Linux support exists.

Getting the Dock to Work

Note: Some files I used are available in this repo so you don’t have to run the scripts in the installer every time and modify them.

  1. Cloned the evdi module repo from GitHub. This contains both the library and kernel module. I ran make, which builds everything. Pretty easy.
  2. Copied the .so library in the library directory to /usr/x86_64-pc-linux-gnu/lib/ (at least on my box)
  3. Copied the .ko kernel module in the module directory to /lib/modules/<KERNEL_VERSION>-gentoo/kernel/extra (I had to create extra). I ran depmod and modprobe and the module loaded without issue.
  4. Downloaded the ZIP with the DisplayLink installer from here. The version I had was DisplayLink USB Graphics Software for Ubuntu (Beta)5.5 Beta-EXE.zip. I used the --noexec flag to extract the files from it (from instructions from here). I did not use the install script (displaylink-installer.sh), but looked at it to determine what else I needed, and I got the following:
    • uDev Rules: This is generated by the install script with the udev-installer.sh script.
    • udev.sh: Script called by the Udev rules script to do setup, also generated by the install script with the udev-installer.sh script.
    • DisplayLinkManager: The management binary, sadly a non-open-source binary. Used the one from the x64-ubuntu-1604 subdirectory.
    • *.spkg: These are firmware files I think.
    • suspend.sh: Script called when the system goes to sleep. This is also generated by the install script.
    • The module configuration that went into /etc/modprobe.d/evdi.conf
  5. I copied the DisplayLinkManager and *.spkg files to /opt/displaylink/.
  6. I copied the generated udev.sh and suspend.sh scripts to /opt/displaylink/ and ensured they were executable. These files are available in the repo, suspend.sh in the pm directory and udev.sh in the udev directory.
  7. I copied the generated udev rules files to /etc/udev/rules.d/. This file is available in the repo in the udev/99-displaylink.rules file.
  8. I created a OpenRC service file in /etc/init.d/dlm, which I derived from this DisplayLink forum post. This is in the repo as the service/dlm file. I also made sure the dlm script was executable.
  9. I added the configuration options evdi initial_device_count=4 into /etc/modprobe.d/evdi.conf. The contents are available in the repo in the modprobe.d/evdi.conf file.
  10. I linked the suspend.sh script into the elogind sleep script directory with
ln -s /opt/displaylink/suspend.sh /lib64/elogind/system-sleep/displaylink-suspend.sh

Then I started the service with

rc-service dlm start

which start without an error.

However, there was still no change from the monitor. Using info hinted here, I ran:

xrandr --setprovideroutputsource 1 0

Still nothing. But then I remembered that we added 4 devices in the module configuration (options evdi initial_device_count=4), I tried other numbers, and when I ran:

xrandr --setprovideroutputsource 4 0

the screen popped to life! Success!

I could then configure it like a normal other monitor and now have a lot of extra screen space for my coding and excess of browser tabs.

Issues

Different Output Numbers

Sometimes,

xrandr --setprovideroutputsource 4 0

didn’t work but

xrandr --setprovideroutputsource 3 0

did. I usually try different numbers and one will eventually work.

Screen Glitches

Sometimes, I’ll start getting screen tearing and glitchy mouse movements when I activate a new screen. I restarted by display manager with:

rc-service display-manager restart

and after a re-login, then running the xrandr command again, the glitches went away. I think it has something to do with the order of what is loaded with the module, driver, and display manager.

Other Resources

Other resources I referenced during my journey: