Skip to content
/ openkvm Public

DIY KVM for remote-controlling a computer even in BIOS

License

Notifications You must be signed in to change notification settings

allape/openkvm

Repository files navigation

OpenKVM

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 the IP-KVM, this project respects VNC protocol.

Just like the MIT license says, no warranty or guarantee.

My dev walkthrough is in WALKTHROUGH.md.

And do NOT use for any illegal purposes.

TODO

  • Remove OpenCV, see WALKTHROUGH.md
  • Installation script
    • Register as a system service
    • Start on boot
  • VNC authentication
    • DES encryption in Golang can NOT directly apply to VNC Authentication
    • Http Basic Auth in web page and API
  • More effective to calculate the difference between frames
    • Balance between the power of SBC and the network efficiency
    • Or achieve more support for noVNC, beyond rfc6143
  • OTG as keyboard and mouse, see Linux USB Gadget API
  • Using a single command to get the frame for Video, like
    v4l2-ctl --device=/dev/video0 --stream-mmap --stream-count=1 --stream-to=- --set-fmt-video="width=640,height=480,pixelformat=MJPG"

Dev Environment

Hardware

NONE of them is sponsored, use them at your own risk!

Essential hardware are:

  • A computer that can run Golang
  • HDMI Recorder, see WALKTHROUGH.md for more details.
    • Or a webcam with an always-on monitor.
      • I know...this is a stupid way -- pointing a camera to a screen.
  • Keyboard & Mouse Emulator
    • ESP32-S3
    • ESP32-S2
    • Arduino?
    • Some other device that supports USB HID output.
      • HID over BLE is not recommended, because it may not work in BIOS.
  • Relay and/or delayed relay

My Gears

  • SBC: OrangePi 3 LTS
    • ¥241 RMB$34 USD
  • HDMI Recorder: hagibis UHC07
    • ¥69 RMB$10 USD
    • ⚠️ This device ONLY supports 1920x1080 and 3840x2160.
  • Keyboard & Mouse: ESP32-S3
  • 5V relay * 2, 5V delayed relay * 1
    • ¥15 RMB$2 USD

Others

  • Test Device:
  • Some SD cards.
  • Some USB Type-C2C/C2A cables.
  • A HDMI cable.
  • Some power supplies.

It costs about ¥300 RMB40 USD.

Price is for reference only, the actual price may vary.

Software

Diagram

飞书文档, FeiShu Doc

diagram.png

Installation

Debian ARM64

  1. Install GO dev kit
    sudo apt-get update
    sudo apt-get install -y wget curl ffmpeg v4l-utils
    GO_ZIP="go1.23.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"
  2. Pull this repo
    sudo apt-get update
    sudo apt-get install -y git
    git clone https://github.com/allape/openkvm.git
  3. Get noNVC
    git clone --depth 1 https://github.com/novnc/noVNC.git
    
    # [Optional] You can run noVNC separately
    python3 -m http.server --directory noVNC/ 8081
  4. Flash ESP32-S3
  5. Run or build repo
    cd openkvm
    
    go mod tidy
    go mod download
    
    cp kvm.new.toml 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 .
    
    #go build -o openkvm .
    #sudo ./openkvm
  6. Open browser and go to http://ip:8080/vnc.html, then click Connect
    • Hostname and port may vary depending on your settings
  7. Open http://ip:8080/ui/button.html to control the relay

Credits