GLKVM Control Skill
Initialization
The following steps must be performed at the start of each session:
Step 1: Get Connection Information
Ask the user for the following information (if not already provided):
- 1. GLKVM IP address (e.g.,
192.168.1.100) - Login password (username is fixed as
admin)
Step 2: Login to Obtain Token
CODEBLOCK0
- - Response
ok: true with a token indicates successful login; the auth_token is also saved in the cookie. - Response with
two_step_required: true means waiting for two-step approval. - All subsequent requests must include
-b /tmp/glkvm_cookies.txt.
All requests use HTTPS with -k (ignore certificate errors).
Feature 1: Screenshot / View Current Screen
Capture and save a screenshot:
curl -sk -b /tmp/glkvm_cookies.txt \
"https://<IP>/api/streamer/snapshot" \
--output /tmp/glkvm_snapshot.jpg
Then use the Read tool to read
/tmp/glkvm_snapshot.jpg to view the image content.
Get thumbnail (recommended for quick preview):
CODEBLOCK2
Screenshot with OCR recognition (returns text):
CODEBLOCK3
Parameter description:
- -
save=true: Save screenshot to device disk - INLINECODE9 : Load previously saved screenshot without re-capturing
- INLINECODE10 : Allow response even when video stream is offline
- INLINECODE11 : OCR region coordinates (-1 = no crop)
Working principle: After taking a screenshot, you must use the Read tool to view the image, understand the current screen state, then decide the next action.
Feature 2: Keyboard Control
2a. Send Single Key
CODEBLOCK4
Common key names (USB HID keycodes):
- - Letters:
KEY_A ~ INLINECODE13 - Numbers:
KEY_1 ~ INLINECODE15 - Function keys:
KEY_F1 ~ INLINECODE17 - Special keys:
KEY_ENTER, KEY_BACKSPACE, KEY_TAB, KEY_ESC, INLINECODE22 - Arrow keys:
KEY_UP, KEY_DOWN, KEY_LEFT, INLINECODE26 - Modifier keys:
KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, INLINECODE30 - Others:
KEY_DELETE, KEY_HOME, KEY_END, KEY_PAGEUP, KEY_PAGEDOWN, INLINECODE36
2b. Send Keyboard Shortcuts
CODEBLOCK5
The keys parameter is comma-separated, following the Web KeyboardEvent.code specification:
ControlLeft, ShiftLeft, AltLeft, MetaLeft, KeyA~KeyZ, Digit0~Digit9, F1~F12, Enter, Escape, Backspace, Tab, Space, Delete, etc.
2c. Type Text String
CODEBLOCK6
Query parameters:
- -
limit (int, default 1024): Maximum characters to send, 0 = unlimited - INLINECODE55 : Key mapping name
- INLINECODE56 (bool): Slow mode, adds delay per key
Note: Only characters present in the keymap are supported; special characters such as Chinese cannot be typed directly.
2d. Reset HID (Release All Keys)
CODEBLOCK7
Call this when keys are stuck or the state is abnormal.
2e. Check HID Status
CODEBLOCK8
Returns keyboard/mouse online status, LED indicators (CapsLock/NumLock/ScrollLock), and mouse positioning mode (absolute/relative).
Feature 3: Mouse Control
3a. Mouse Button Click
CODEBLOCK9
3b. Absolute Mouse Move (for absolute positioning mode)
Coordinate system: (0,0) = screen center; (-32768,-32768) = top-left; (32767,32767) = bottom-right
CODEBLOCK10
Pixel coordinate conversion (screen resolution W x H, target pixel px, py):
CODEBLOCK11
3c. Relative Mouse Move
CODEBLOCK12
Range -127 ~ 127; call multiple times for larger movements.
3d. Mouse Scroll Wheel
CODEBLOCK13
delta_y positive = scroll up, negative = scroll down; range -127 ~ 127.
Feature 4: Fingerbot Physical Button Robot
Fingerbot controls a physical press robot via Bluetooth to simulate pressing physical buttons (power button, reset button, etc.).
4a. Check Connection
CODEBLOCK14
Returns result.exist: true if the Bluetooth adapter is connected.
4b. Check Battery
CODEBLOCK15
Returns result.battery: battery percentage from 0 to 100.
4c. Perform Press Click
CODEBLOCK16
Parameter description:
- -
press_time: Press duration (milliseconds), range 100~60000 - INLINECODE60 :
1 = low angle (light press), 2 = high angle (deep press)
4d. Check Firmware Version
CODEBLOCK17
Feature 5: ATX Power Management
ATX power control is achieved through Fingerbot physical pressing (no separate ATX interface in the API).
Before use, confirm that Fingerbot is connected and installed near the host's power/reset button:
CODEBLOCK18
| Operation | Command |
|---|
| Power on | INLINECODE63 |
| Normal shutdown (trigger ACPI) |
click?press_time=500&angle_enum=2 |
| Force power off |
click?press_time=5000&angle_enum=2 |
| Reset |
click?press_time=200&angle_enum=2 |
Feature 6: System Control
Reboot GLKVM Device Itself
CODEBLOCK19
Note: This reboots the GLKVM device, not the controlled host.
Feature 7: Firmware Upgrade
7a. Get Local Firmware Version
CODEBLOCK20
Response fields:
- -
result.version: Local firmware version string - INLINECODE68 : Device model (e.g.,
RM1)
7b. Compare with Server Version
CODEBLOCK21
Response fields:
- -
result.local_version / result.local_model: Current firmware version and model - INLINECODE72 /
result.server_model: Latest version available on the update server - INLINECODE74 : English release notes
- INLINECODE75 : Chinese release notes
7c. Download Firmware from Cloud (OTA)
Trigger cloud download (returns immediately, downloads in background):
CODEBLOCK22
Response: result.size = total firmware size in bytes.
Check download progress:
CODEBLOCK23
Response: result.size = bytes downloaded so far, result.total_size = total size.
Cancel an in-progress download:
CODEBLOCK24
7d. Upload Firmware File Manually
CODEBLOCK25
- - Request body:
multipart/form-data, field name INLINECODE80 - Requires
Content-Length header (curl sets it automatically) - Firmware is saved to
/userdata/update.img on the device - Response:
result.filename (original filename) and result.size (bytes)
7e. Start Firmware Upgrade
CODEBLOCK26
- - Must upload or download firmware first (step 7c or 7d)
- Device reboots automatically after upgrade completes
- Response:
result.status ("Upgrade started" or "Upgrade failed"), result.stdout, INLINECODE89
Typical OTA upgrade workflow:
1. /api/upgrade/compare → check if update available
2. /api/upgrade/download → start background download
3. /api/upgrade/download_info (poll) → wait until size == total_size
4. /api/upgrade/start → apply upgrade (device reboots)
Feature 8: MSD Remote ISO Download
Download an ISO image from a remote URL directly to the MSD storage, without transferring through the client machine.
8a. Remote Download to MSD
CODEBLOCK28
Query parameters:
- -
url (required): Remote file download URL - INLINECODE91 (optional): Target image name on MSD storage; auto-inferred from URL if omitted
- INLINECODE92 (optional): Subdirectory path prefix
- INLINECODE93 (optional): Skip TLS certificate verification, default INLINECODE94
- INLINECODE95 (optional): Connection timeout in seconds, default INLINECODE96
- INLINECODE97 (optional): If
1, deletes partial file on write failure
Response: Streaming NDJSON (Content-Type: application/x-ndjson)
Each line is a JSON object reporting progress; the last line is the final result:
CODEBLOCK29
Fields:
- -
image.name: Image filename - INLINECODE101 : Total file size in bytes (0 if server did not return
Content-Length) - INLINECODE103 : Bytes written so far
Error responses:
- -
400: Remote URL unreachable or request failed - INLINECODE105 : Insufficient storage space on MSD partition
Typical workflow for remote ISO installation:
1. /api/msd/partition_disconnect → ensure drive is disconnected
2. /api/msd/write_remote?url=<ISO_URL> → download ISO directly from internet
3. (Poll NDJSON stream until size == written)
4. /api/msd/partition_connect → present drive to target host
5. (On target host) boot from USB drive, complete installation
6. /api/msd/partition_disconnect → disconnect when done
Standard Operation Workflows
Click a Specific Position on Screen
CODEBLOCK31
Type Text
CODEBLOCK32
General Automation Workflow
CODEBLOCK33
Error Handling
| Situation | Solution |
|---|
| Login returns 401/403 | Wrong password, ask the user again |
| Screenshot returns 503 |
Video stream unavailable, check HDMI connection and retry |
| HID key stuck | Call
/api/hid/reset to release all keys |
| Fingerbot exist returns false | Bluetooth adapter not connected, cannot use Fingerbot/ATX |
| Cookie expired (401) | Re-execute login process |
| No response to operation | Take screenshot to confirm current state, then decide next step |