DIY KVM device for remote-controlling a computer. KVM
stands for Keyboard & Video & Mouse
.
A side system on a rackmount server,
IPMI
in Dell Server
for example.
Unlike an IP-KVM, this project respects VNC protocol.
Just like the MIT license says, no warranty or guarantee.
And do NOT use for any illegal purposes.
VNC Authentication
Video
, like
v4l2-ctl --device=/dev/video0 --stream-mmap --stream-count=1 --stream-to=- --set-fmt-video="width=640,height=480,pixelformat=MJPG"
NONE of them is sponsored, use them at your own risk!
Essential hardware are:
HDMI Recorder
HDMI Recorder
is a USB 3.0
device.HDMI Recorder
on a USB 2.0
port.HDMI Recorder
itself,HDMI Recorder
I bought can NOT work on Linux (Debian ARM or Ubuntu 24.04) even with a USB 3.0
port.USB 3.0
.# Display all USB device, make sure the HDMI recorder is in 480M or above
lsusb -t
# /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
# |__ Port 1: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
# |__ Port 1: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
# |__ Port 1: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
# |__ Port 1: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
# Get the id of the USB device
lsusb
# Bus 001 Device 003: ID 1de1:f105 Actions Microelectronics Co. Hagibis
# Reset the USB device
# Replace this with the id or the name of your USB device.
# For me, this is `Hagibis` or `1de1:f105`
usbreset Hagibis
# Capture one frame from device
v4l2-ctl --verbose \
--device=/dev/video0 \
--stream-mmap \
--stream-count=1 \
--stream-to=frame.jpg \
--set-fmt-video="width=640,height=480,pixelformat=MJPG"
# BUT! But, in size of 1920x1080, frame will be corrupted
# Without resetting the USB device, there will be some error message in `dmesg` command
# Non-zero status (-71) in video completion handler.
# Here are some helpful commands
# List all video devices
v4l2-ctl --list-devices
# List all supported formats for a video device
v4l2-ctl --list-formats -d [device name or path or index] # v4l2-ctl --list-formats -d 0
# List all supported frame sizes
v4l2-ctl --list-framesizes [pixel format] -d [device] # v4l2-ctl --list-framesizes MJPEG -d 0
webcam
with an always-on monitor.
SBC
: OrangePi 3 LTS
241 RMB
$34 USD
HDMI Recorder
: hagibis UHC07
69 RMB
$10 USD
Keyboard & Mouse
: ESP32-S3
52 RMB
$7.5 USD
15 RMB
$2 USD
USB Type-C2C/C2A
cables.HDMI
cable.It costs about 300 RMB
40 USD
.
Price is for reference only, the actual price may vary.
sudo apt-get update
sudo apt-get install -y wget curl ffmpeg v4l-utils
GO_ZIP="go1.22.3.linux-arm64.tar.gz"
wget "https://go.dev/dl/$GO_ZIP"
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf "$GO_ZIP"
sudo apt-get update
sudo apt-get install -y git
git clone https://github.com/allape/openkvm.git
sudo apt-get update
sudo apt-get install -y build-essential g++ cmake pkg-config unzip libopencv-dev
# But in BTT-Pi, it is only up tp v4.5.1
# Then, I have to change the version of `gocv.io/x/gocv` to corresponding version
sed -i 's/gocv.io\/x\/gocv v0.36.1/gocv.io\/x\/gocv opencv-4.5.1/g' openkvm/go.mod
mkdir opencv4 && cd opencv4
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
unzip opencv.zip
mkdir -p build && cd build
cmake ../opencv-4.x
cmake --build .
git clone --depth 1 https://github.com/novnc/noVNC.git
# [Optional] You can run noVNC separately
python3 -m http.server --directory noVNC/ 8081
PlatformIO
TabPROJECT TASKS
-> Default
-> General
-> Upload
command palette
and type PlatformIO: Upload
+ shift + p
on macOS to open command palettectrl + shift + p
on Windows or UbuntuPerferences
-> Additional Board Manager URLs
->https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json
ESP32S3 Dev Module
and corresponding portUpload
cd openkvm
cp kvm.toml.tpl kvm.toml
# Find out serial port
dmesg | grep tty
# Edit this file to apply your settings
vim kvm.toml
# Should run with super user privilege
sudo go run .
Connect