cli-serial-hid-kvm
CLI tool for KVM control — thin client for serial-hid-kvm.
Architecture
┌──────────┐ TCP ┌─────────────────┐ USB/HDMI ┌───────────┐
│ shkvm │ ──────────────── │ serial-hid-kvm │ ──────────────── │ Target PC │
│ (CLI) │ port 9329 │ (server) │ CH9329 + Cap │ │
└──────────┘ └─────────────────┘ └───────────┘
The CLI connects to a running serial-hid-kvm server over TCP. The server handles all hardware interaction (USB HID via CH9329 and HDMI capture). OCR is performed locally by the CLI using Tesseract.
Prerequisites
- serial-hid-kvm server running with
--headless --api(or with GUI + API enabled) - Tesseract OCR installed for
ocrandexeccommands - Python 3.10+
Installation
pip install cli-serial-hid-kvm
Or for development:
git clone https://github.com/sunasaji/cli-serial-hid-kvm.git
cd cli-serial-hid-kvm
pip install -e .
Quick Start
# Start the KVM server (on the machine connected to target PC)
serial-hid-kvm --headless --api
# Use shkvm from any machine that can reach the server
shkvm info # check connection
shkvm type "ls -la{enter}" # type on target PC
shkvm capture -o screen.jpg # take screenshot
shkvm ocr # read screen text
shkvm exec "echo hello" -w 2 # run command and read output
Command Reference
Keyboard
| Command | Description |
|---|---|
shkvm type TEXT [-d MS] [-r] |
Type text with optional char delay. Supports inline tags: {enter}, {tab}, {ctrl+c}, {0xNN}. Whitelist-based: unknown {content} passes through literally. -r (raw mode) disables tags, \n → Enter |
shkvm key KEY [-m MOD] |
Send single key press. -m can be repeated: -m ctrl -m shift |
shkvm keys JSON [-d MS] |
Send key sequence from JSON array |
Mouse
| Command | Description |
|---|---|
shkvm move X Y [-r] |
Move cursor (absolute, or relative with -r) |
shkvm click [-b BUTTON] [-x X] [-y Y] |
Click (default: left) |
shkvm drag X1 Y1 X2 Y2 [-b BUTTON] |
Drag from start to end |
shkvm scroll AMOUNT |
Scroll wheel (+up, -down) |
Screen
| Command | Description |
|---|---|
shkvm capture [-o FILE] [--base64] |
Save screenshot or output base64 to stdout |
shkvm ocr |
Capture + OCR, print text to stdout |
shkvm exec CMD [-w SEC] |
Type command, Enter, wait, then OCR |
Device Management
| Command | Description |
|---|---|
shkvm info |
Show device info (JSON) |
shkvm devices |
List capture devices |
shkvm set-device DEV |
Switch capture device by index or path |
shkvm set-resolution W H |
Set capture resolution |
Global Options
| Option | Description |
|---|---|
-H, --host HOST |
KVM server host (overrides SHKVM_API_HOST) |
-p, --port PORT |
KVM server port (overrides SHKVM_API_PORT) |
Configuration
All settings can be configured via environment variables:
| Variable | Default | Description |
|---|---|---|
SHKVM_API_HOST |
127.0.0.1 |
KVM server host |
SHKVM_API_PORT |
9329 |
KVM server port |
SHKVM_OCR_CMD |
(auto-detect) | Path to Tesseract binary |
SHKVM_CAPTURE_LOG_DIR |
~/.local/share/cli-serial-hid-kvm/captures |
Capture log directory (set to empty string to disable) |
License
MIT
Metadata
Release files for cli-serial-hid-kvm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cli_serial_hid_kvm-0.1.0.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cli_serial_hid_kvm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / cli_serial_hid_kvm-0.1.0.tar.gz
| Download URL | cli_serial_hid_kvm-0.1.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b46010b0c9c36e88f28e6173c4a46c04bc0163e05510619bf96abd5aaaaa4cd
|
|
BLAKE2b-256 checksum How to use checksums |
4993855b6b98ae7352df8f08cc5f0739a6ab6fb033e005ea26802891824a9570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.
Transparency logRelease files / cli_serial_hid_kvm-0.1.0-py3-none-any.whl
| Download URL | cli_serial_hid_kvm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3503a583ec071c5afcc16796bea47f00ec2e11051b694e95d91ffa2d8aec1ee8
|
|
BLAKE2b-256 checksum How to use checksums |
9efb76a6358020b81038ff0d4ed613a88bdd0a7d45d096dae47b304d0909c4aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.
Transparency log