KV: a remote KVM application
I had been reading about remote KVMs for a while. There are several, like PiKVM, JetKVM, etc. I decided I wanted one to access my server at home because it has a nasty tendency to lose network connectivity, and I wanted to be able to fix it without having to go to the office and plug in stuff into it.
This is not like running RDP or VNC on the server in that to the server this is hardware. It works no matter how crashed or disconnected the server is, as long as it has power. It is like having a monitor, keyboard and mouse plugged in to the server, but remotely.
I had all the hardware I needed:
- A Radxa Zero, which has OTG support so I could use it as a USB device.
- A USB capture dongle, which are cheap and easy to find, to capture the HDMI output of the server.
But I just could not make it work. PiKVM, the most popular one, makes it pretty difficult to make it work on anything other than the exact hardware configs they support, and those are exactly the ones I don't have.
I could not find any implementation that was easy to setup and supported the hardware I had, so I decided to write my own.
You can get the code at GitHub of course. It compiles to a single binary. It only requires you to have ffmpeg installed, and it should just work as long as your hardware supports OTG, you have a USB capture dongle, and you plug all the cables correctly.
One USB cable and one HDMI cable go from the server to the Radxa Zero (the HDMI via capture dongle) and you run the one binary built from this code on the Radxa Zero. It will start a web server on port 3000, and you can access it from any browser.
The web interface is very simple, but it works. You can see the video feed, and you can send keyboard and mouse events to the server. You can even provide a disk image that the server will think is a USB drive. I suppose you can even install the OS in the server that way, but I have not tried it.
If you want to access it more remotely, just setup a VPN in the KVM itself.