How To Make Your KVM Work With Your Raspberry Pi

Introduction

For just over four years I have been successfully operating a Pi 3B, running Ubuntu Mate 16.04, via my MT-VIKI 4-port USB-HDMI KVM.

At the beginning of Mardh 2021 I bought a Pi 4B with a view to it taking over from my 3B. It didn't take me very long to discover that it would not play nicely with my KVM - the keyboard and mouse were unresponsive although the video was fine. Eventually I tried the 3B running Ubuntu 16.04, Ubuntu 20.04 and the latest Raspberry Pi OS and discovered that the KVM would only work with Ubuntu 16.04. Further investigation revealed that Ubuntu 16.04 used the hid-generic driver for the KVM whereas the later operating systems used the logitech-djreceiver driver. Clearly the logitech-djreceiver driver is not included with Ubuntu 16.04.

The solution to the problem is to blacklist the logitech-djreceiver driver and then the KVM will operate as expected.

How To Diagnose And Fix The Problem

The following instructions may work if you have a different controller in your KVM but you will have to adapt the strings to look for accordingly.

Unless you have a keyboard directly attached to your Pi then you should SSH into it.

My KVM is telling the Pi that it has a Logitech controller (Vendor=046d ProdID=c534) in it and this is what is causing the Pi to load the logitech-djreceiver driver.

This can be determined simply by executing the following commands in the terminal window:

lsusb

If the output includes a line as shown below then your KVM is similar to mine (Bus and Device numbers may vary)

Bus 001 Device 007: ID 046d:c534 Logitech, Inc. Unifying Receiver
lsmod | grep hid

If the output includes a line as shown below then it is using the same driver as mine (the two numbers may vary)

hid_logitech_dj        28672  0

Now banish that driver to outer darkness

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add this line

blacklist hid_logitech_dj

Press ctrl-X, then press 'y' followed by Enter.

sudo reboot now

On rebooting your KVM should work. Yay!