Using a KVM for Work From Home

Existing setup

For a long time my work from home setup was to have my work laptop on the corner of my desk. Only the laptop screen, touchpad for moving the cursor, built-in keyboard, aaaand that's it. I'd work like that while two screens are right, behind the laptop, turned off. Maybe a bit silly, but the idea of changing out cables every day just sounded super inconvenient to me.

I stopped playing my digital piano after it got damaged (by my lovely cat). After getting rid of I had a lot more desk space, and that meant I had the opportunity to rethink my WFH setup.

My work laptop was now on the center of my desk and connected to a keyboard, mouse, and one additional screen using a DisplayPort USB-C adapter. This already made work more enjoyable, but switching my keyboard and mouse between my work laptop and personal computer was annoying. I also wasn't able to connect my second screen, because this screen only has a single digital out. I wasn't about to crawl under my desk twice a day to swap it between my PC/laptop.

So already these changes were good, but:

I wasn't sure these devices existed at first but I began looking for KVM switch/USB-C hub boxes.

KVM

Thankfully, these devices do exist. You connect USB devices and displays into a single box and this combines it into a signal traveling over a single USB-C cable. That sounds like a simple hub but this actually has two USB-C cables that go to two different computers. With the push of a single button the signal is switched from one device to the other.

This sounds great, but unfortunately USB-C is not that simple.

I was sure the laptop would be fine with it, but what about the desktop PC.. Can it receive video over USB-C?

I didn't think so, and after a bit of research I understood I needed some kind of expansion card.

USB-C DisplayPort Alternate Mode

Right, so the KVM I was considering uses "DP Alt Mode" to send video, what does that mean?

Apparently USB-C allows other protocols to travel over the same wire. This is how USB-C supports Thunderbolt and DisplayPort data.

Most GPU's don't have a USB-C port, and while Linux "supports" USB-C alternate mode, it's not clear to me what this support means exactly. It didn't look like it would magically make the GPU see a screen that is connected over USB-C to the motherboard.

I was losing hope until I learned about this cool expansion card from this blog:

Diagram of a computer with a DisplayPort cable connected to itself.
On one end is a PCIe card which also has a USB-C input.
On the other end is the video input of the computer.

https://www.delock.de/produkt/89582/merkmale.html

I don't really know how the device works, and I'm not sure whether it depends on any operating system support, but this is a USB-C interface card that can combine a DisplayPort signal into USB-C using DP Alt mode.

You have to connect a DisplayPort cable from the PCIe card to the GPU, which looks a bit weird but makes sense.

This is great, and unlike 99.99999% of hardware it advertises Linux support, so it's guaranteed to work perfectly, right? :-)

Well, I wasn't too sure, so I first ordered the PCIe card to test before getting the KVM. To my surprise, it worked exactly as it should. The model I bought came with a single, short mounting bracket which didn't fit my PC. After bending some of the bracket and cutting up one of the case's slot covers, I was able to get a good mount.

VT2900

I settled on the VisionTek VT2900 KVM. This has pretty much all the features I need and not much more. HDMI and DP out, can switch between two computers, and it has a couple USB slots for keyboard and mouse. It can even deliver 100W of power to my laptop.

Because the KVM doesn't support high refresh rates or resolution when multiple screens are connected, I decided to try to connect my main screen directly to my PC and only have the secondary screen go through the KVM. For work, I don't care as much about resolution/refresh rate, so both screens are connected through the KVM to the laptop.

Here's a perfect diagram that may not be criticised:

Diagram showing how several devices are wired up to a KVM.
The screen on the left is connected to the computer and the KVM while the screen on the right is only connected to the KVM.
The KVM is connected to two screens, a desktop computer, a laptop, a wireless mouse dongle, and a keyboard.

Oh no

The KVM finally arrived and I started playing with it. At first, everything seemed fine but I soon began experiencing problems.

On the laptop there were no issues, but on my PC the screen connected through the KVM would turn black for a couple seconds at a time. Sometimes there would be a couple minutes between this happening, other times it would happen every couple of seconds.

At first, I didn't know what caused this. I tried a lot of stuff to diagnose/fix it:

  1. Trying a couple different cables,
  2. Switching ports on the KVM (this seemed to help at first but then it broke again),
  3. Installing Windows on my PC (the horror)
    1. To see if the issue was Linux specific (it wasn't)
    2. To try to update my GPU's BIOS (it already was up to date)
  4. Lowering the resolution of the screen,
  5. Disconnecting/turning off almost everything except the screen from the KVM.

Most of these things made little difference. Finally, I concluded it was probably the cable for these reasons:

  1. It mostly appeared to be independent of the ports on the KVM,
  2. Using different USB-C cables made things much worse or slightly better,
  3. Someone turning on the lights in the room behind the computer caused the display to turn black about 50% of the time.

Yeahh... that last one surprised me. I had a hunch after it happened a couple times, and after testing, I was able to make it happen consistently. I guess electrical interference causes the data to be corrupted. I knew this kind of stuff was possible but personally never experienced something like it before.

Sure enough, getting new high quality USB-C cables solved all problems. 🎉 (well.. mostly, I still get the occasional flicker maybe about once a week, but I can live with that.)

It's a bit frustrating that the included cables didn't work properly. Maybe I got a bad batch of cables or the interference is especially bad here.

TODO: investigate electric ghosts.

Conclusion

Anyhow, it's working now and I'm happy.

I feel silly for not doing this sooner. I know multiple screens make things more manageable, but somehow I convinced myself that it wasn't necessary. Probably I didn't want to get rid of the piano on my desk, which meant there wasn't space for this kind of setup. In hindsight, I'm glad the piano is gone now, since it was apparently also causing some of my hand pain. Guess I my cat to thank for this :^).

Photo of two monitors connected to a laptop.
There's a wireless mouse and a keyboard with a wire that goes to a box underneath the left monitor.
The laptop has a wire going to this same box.