* test(e2e): lower s3 wake version gate
* test(e2e): preserve device logs across restarts
Capture failing device logs before later restarts can truncate last.log, and keep a rotated copy available during global teardown.
* feat(video): experimental 120 Hz low-latency mode
Add an opt-in setting that swaps the JetKVM default EDID for one
advertising 848x480@120 (preferred) and 1280x720@120. At 120 fps the
per-frame display→encode delay drops from ~16.7 ms to ~8.3 ms, halving
source-side video latency vs the standard 1080p60 path.
The TC358743 capture chip on JetKVM v1 has a hard ~120 Hz vrefresh
ceiling (Toshiba spec is 1080p@60; everything above 60 Hz is
undocumented territory). 144/240 Hz were tested and do not lock — the
chip's internal blocks above the TMDS PHY were never validated past
60 Hz. 120 Hz works reliably across both 480p and 720p; that's what
this EDID advertises.
Wiring:
- internal/native/video.go: new LowLatency120HzEDID constant
(CVT-RB, EDID 1.4, single base block, no CEA extension)
- config.go: VideoLowLatencyMode bool, with reconciliation on load —
toggling only swaps EdidString when it currently holds one of the
well-known JetKVM defaults; user-supplied custom EDIDs are preserved
- jsonrpc.go: getVideoLowLatencyMode / setVideoLowLatencyMode RPCs
- UI: experimental Checkbox in Settings → Video and an extra entry
in the EDID preset dropdown
Source-side note: enabling the toggle does not switch the source PC's
display mode. The user must manually pick 1280x720@120 or 848x480@120
in their OS display settings; the EDID alone just tells the source
what's allowed.
scripts/edid_gen.py is the generator used to produce the EDID hex.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(video): address PR review on 120 Hz toggle
Single source of truth for the toggle is now `EdidString`. The separate
`VideoLowLatencyMode` config bool is gone, along with the load-time
reconciliation logic that could silently revert the EDID dropdown's
choice on reboot.
Addresses:
- cursor[bot] HIGH "Config reconciliation reverts explicit EDID
dropdown choices on reboot" — drop `VideoLowLatencyMode` field;
`rpcGetVideoLowLatencyMode` now derives state from `EdidString`,
`rpcSetVideoLowLatencyMode` only writes `EdidString`. UI toggle is
derived from `edid` state. Dropdown ↔ toggle can no longer drift.
- Copilot ui/src/routes/.../video.tsx:30 — same root cause; same fix.
- Copilot ui/src/routes/.../video.tsx:199 — drop the spurious
`.toUpperCase()` on the matched-EDID value so SelectMenuBasic strict
equality matches the option's actual `value`.
- Copilot jsonrpc.go:276 + config.go:311 — case-insensitive EDID
comparisons via `strings.EqualFold`.
- Copilot scripts/edid_gen.py:13 — drop unused `import struct`.
- Copilot scripts/edid_gen.py:63 — `pclk_khz` was holding Hz; rename
to `pclk_hz` and use a `raw_pclk_hz` intermediate for the pre-quantized
value. Generator output is byte-identical.
- cursor[bot] LOW en.json:1041 "wrong advice when disabling" — split
the single `video_low_latency_set_success` (which always told users
to switch to 120 Hz) into `video_low_latency_enabled` and
`video_low_latency_disabled`; the disabled message tells the user to
switch their source back to its usual resolution.
Also: small UX cleanup — extracted `applyEDID(...)` helper so the
toggle and the dropdown don't double-fire success notifications.
Verified locally: `go vet` clean, `tsc --noEmit` clean, `oxlint` 0
errors, `python3 -c "import py_compile; py_compile.compile(...)"` OK,
and the regenerated EDID hex matches `LowLatency120HzEDID` byte for
byte.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(video): replace 120 Hz toggle with four single-mode EDIDs in the dropdown
Drops the experimental "Low Latency 120 Hz Mode" toggle and the
LowLatency120HzEDID bundle (which packed both 848x480@120 and 1280x720@120
DTDs into a single EDID) in favor of four standalone single-mode EDIDs
added directly to the existing EDID dropdown:
- JetKVM 1280x720 @ 120 Hz (low latency)
- JetKVM 1280x720 @ 60 Hz
- JetKVM 848x480 @ 120 Hz (low latency)
- JetKVM 848x480 @ 60 Hz
Each EDID advertises exactly one DTD, the monitor range descriptor, and
the model name — no CEA extension. Generated by scripts/edid_gen.py.
Why the redesign
The toggle was special-casing a single EDID bundle and trying to keep
two pieces of state (the toggle and the EDID dropdown) in agreement.
The reviewer flagged that the load-time reconciliation could revert
explicit EDID-dropdown choices on reboot, and even the simpler
derive-toggle-state-from-EdidString version was carrying:
- a separate i18n string set for toggle-on / toggle-off,
- a Checkbox plus an extra dropdown row labeling the same EDID,
- special-cased applyEDID plumbing distinct from setEDID,
- a config-load reconciliation path.
Treating the 120 Hz modes as ordinary EDID choices removes all of
that. Picking a 120 Hz EDID writes through setEDID like every other
entry; the dropdown is the only source of truth.
Bundling 480p120 and 720p120 into one EDID also forced the source PC
to choose between two preferred modes. With separate EDIDs the source
sees exactly one preferred timing per choice.
Changes
internal/native/video.go: add EDID720p120, EDID720p60, EDID480p120,
EDID480p60. Drop LowLatency120HzEDID.
jsonrpc.go: drop rpcGetVideoLowLatencyMode / rpcSetVideoLowLatencyMode
and their handler registrations. Drop the now-unused native and
strings imports.
ui/src/routes/devices.\$id.settings.video.tsx: drop the Checkbox, the
derived lowLatencyMode flag, the handleLowLatencyChange handler, the
applyEDID helper, and the warning paragraph. Add four new entries to
the EDID dropdown.
ui/localization/messages/en.json: drop the five video_low_latency_*
keys and the single-bundle video_edid_jetkvm_120hz key. Add four new
per-mode keys; update video_edid_jetkvm_default to spell out the
resolution so the dropdown is internally consistent.
Verified locally: go vet clean on all packages, tsc --noEmit clean,
oxlint 0 errors, EDID hex round-trips byte-for-byte through
scripts/edid_gen.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Drop unused EDID constants; fix CVT-RB v1 vertical timing in edid_gen.py
internal/native/video.go: the four EDID720p120 / EDID720p60 / EDID480p120 /
EDID480p60 constants were never read — the dropdown carries the hex
inline. Remove them; nothing else in the Go side referenced them.
scripts/edid_gen.py: CVT-RB v1 specifies a fixed 3-line vertical front
porch and an aspect-dependent vsync; the back porch absorbs the
remainder of v_blank. The previous implementation had it backwards
(back porch fixed at RB_V_BACK_PORCH, front porch = remainder), which
produced a multi-hundred-line front porch and a 6-line back porch —
technically a valid frame, but not CVT-RB v1. If the recomputed back
porch falls below the spec minimum, bump v_blank so it does, and let
v_total follow.
ui/src/routes/devices.\$id.settings.video.tsx: regenerate the three
affected EDID hex strings (720p120, 720p60, 480p120). 480p60 is
unchanged because its v_blank already left front porch = 3 in the
old code path. All four still lock end-to-end on TC358743 hardware.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Set sRGB color space + 640x480@60 established-timing in generated EDIDs
scripts/edid_gen.py:
- Feature-support byte (offset 24): 0x0A -> 0x0E. Adds the sRGB
color-space bit while keeping the existing flags (digital, RGB 4:4:4,
YCbCr 4:2:2, preferred timing in DTD0). EDID 1.4 already requires
DTD0 to be the preferred timing; tagging sRGB lets the source treat
the chromaticity block as authoritative instead of guessing.
- Established-timings byte (offset 35): 0x00 -> 0x20. Bit 5 advertises
640x480@60 as a VGA-fallback mode some sources fall back to during
early-boot / BIOS. The source still prefers DTD0 for the active
desktop, so this is harmless for the 120 Hz / 60 Hz advertised modes.
ui/src/routes/devices.\$id.settings.video.tsx: regenerate all four
dropdown EDIDs with the new flag bytes and recomputed checksums.
Strings are now uppercase to match the rest of the dropdown.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(video): plumb source vrefresh into MPP encoder rate control
The MPP H.264/H.265 rate-control structure has Src/Dst FrameRateNum/Den
fields the firmware never set, so MPP defaulted to fps_fix [30/1].
That made the encoder size its bitrate budget for 30 fps and behave
unpredictably when 120 fps arrived from the capture chip.
Now run_detect_format rounds the v4l2 dv-timings vrefresh to an integer
(stored in detected_fps), and run_video_stream passes that value through
venc_start -> populate_venc_attr where it's written into both Src and
Dst FrameRate fields. GOP is sized to fps/2, which keeps the IDR cadence
at ~0.5s for any source refresh — same WebRTC recovery latency at 60 Hz
and 120 Hz.
run_detect_format now also restarts the streaming pipeline when the
rounded fps changes by more than ±1 fps, so an EDID swap that keeps
resolution but changes refresh (e.g. 720p60 -> 720p120) actually
reconfigures the encoder. The ±1 tolerance absorbs CVT-RB rounding
(119.91 fps and 119.87 fps both round to 120).
Verified on device:
before: fps fix [30/1] -> fix [30/1] gop i [30]
after: fps fix [120/1] -> fix [120/1] gop i [60]
WebRTC inbound-rtp framesPerSecond now sustains ~120 with 0 dropped
packets at 720p120, 19 ms jitter buffer, glass-to-glass delay halved
on a 120 Hz panel.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Collapse 4 single-mode EDIDs into one combined 720p entry
Drop the four single-mode 480p/720p × 60/120 EDIDs and replace them
with one multi-mode JetKVM 720p EDID that advertises both 1280x720@120
(DTD0, preferred) and 1280x720@60 (DTD1). Drop 480p entirely — 848x480
is non-standard and the source PC's display panel UI usually doesn't
expose it.
The source picks 60 Hz vs 120 Hz via OS-side display settings
(`xrandr --rate 60/120` on Linux, Display Settings on Windows) without
needing to swap EDIDs. The encoder-fps plumbing from fa36843 already
reconfigures MPP on each v4l2 source-change event, so rate swaps work
end-to-end against this single EDID.
Validated at edidcraft.com: 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Fold low-latency 720p modes into the JetKVM default EDID
The JetKVM v1 default EDID had two empty CTA-extension DTD slots after
its existing data blocks (audio, YCbCr 4:2:2, vendor-specific). Use the
first slot to advertise 1280x720@120 alongside the existing 1080p60
(DTD0, preferred) and 1280x720@60 (DTD1) base-block timings.
Source picks rate via OS display settings (`xrandr --rate 120`, Windows
Display Settings, etc.) — no separate "low latency" EDID needed in the
dropdown. The encoder-fps plumbing from fa36843 already reconfigures
MPP on every v4l2 source-change event, so OS-side rate swaps work
end-to-end against this single combined EDID.
Migration: config.LoadConfig now also rewrites EdidString to the new
default when the user is currently on the previous JetKVM v1 EDID
(without the 720p120 DTD), so existing devices auto-pick up the
high-refresh option on next boot.
Validated at edidcraft.com: 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Drop scripts/edid_gen.py — exploration tool, not a build dependency
The Python EDID generator was only used during this PR's development
phase to probe the TC358743 chip's max vrefresh and produce candidate
EDIDs. Now that the only EDID change is one DTD added to the JetKVM
default (a fully-validated 18-byte hex string in
internal/native/video.go and ui/src/routes/devices.\$id.settings.video.tsx),
the generator is no longer referenced by any code path. Drop it from
the PR to keep the diff focused on the runtime change. Available in
git history if anyone wants to extend the EDID set later.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Revert "fix(video): plumb source vrefresh into MPP encoder rate control"
This reverts commit fa36843. Empirically the MPP encoder forwards every
input frame whether or not Src/DstFrameRateNum/Den are set in the rate
control struct — those fields appear to only size the bitrate budget,
not gate frame submission. With this code in, dmesg shows
fps fix [120/1] -> fix [120/1] gop i [60]; with it reverted, dmesg
shows fps fix [30/1] -> fix [30/1] gop i [30]; in both cases WebRTC
inbound-rtp framesPerSecond sustains ~120 at the receiver. Drop the
plumbing to keep the PR's surface area minimal — the EDID-side change
alone is what unlocks 120 Hz end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Move 720p120 DTD from CTA extension to base block
NVIDIA's display driver enumerates base-block DTDs reliably but ignores
DTDs in the CTA extension that don't carry a CTA-861 VIC. 1280x720@120
isn't a CTA VIC, so the previous layout (720p120 in CTA-extension first
DTD slot) silently dropped the 120 Hz mode on GeForce hosts — `xrandr`
listed 1080p60 / 720p60 / 640p variants only.
Swap base-block DTD1 from 720p60 to 720p120. 720p60 stays advertised
through the Standard Timings block (0x81C0 at offset 40), which every
driver respects. Also drop the now-redundant 720p120 DTD from the CTA
extension and add the prior CTA-only EDID to the migration list so
existing devices auto-upgrade on next boot.
Validated at edidcraft.com: 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Reapply "fix(video): plumb source vrefresh into MPP encoder rate control"
This reverts commit 3cb61dfc8f.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Adam Shiervani <adam.shiervani@gmail.com>
Annotate the H.264/H.265 bitstream with proper VUI colour_primaries,
transfer_characteristics, and matrix_coefficients (BT.709 for >576p,
SMPTE 170M otherwise) plus video_full_range_flag=0. Without this,
browser WebRTC decoders fall back to BT.601/full-range guesses,
producing tinted output on HD sources.
Also set the matching V4L2 capture colorimetry hints and hoist
constant per-stream fields out of the per-frame SendFrame loop.
The 4096-bit limit produced ~500-byte serials that violate RFC 5280
§4.1.2.2's 20-octet cap. Apple's DER parser enforces this strictly,
so URLSession, NWConnection, AVFoundation and every other client on
macOS/iOS/tvOS rejected the cert with "Unknown format in import"
before any trust evaluation ran.
Lower the limit to 128 bits (matching Go stdlib's generate_cert.go
example) and add a one-shot migration that drops any already-baked
oversized CA, plus the leaves it issued, on startup so existing
devices recover without manual SSH cleanup.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* fix(keyboard): keep modifiers out of auto-release
Prevent per-key auto-release from dropping held modifiers during jitter while keeping explicit cleanup paths covered by E2E tests.
* fix(keyboard): keep modifiers out of auto-release
Prevent per-key auto-release from dropping held modifiers during jitter while keeping explicit cleanup paths covered by E2E tests.
* chore(keyboard): trim autorelease comments
Keep comments focused on keyboard behavior and remove branch-specific narrative from the tests.
* fix(keyboard): reset keepalive timing on key state changes
Reset session keepalive timing on every keyboard state change so stale gaps do not poison later holds under modifiers.
Many Linux browsers (Chrome on NVIDIA proprietary, Brave/Chromium on
Wayland, most Firefox builds) advertise H.265 in
RTCRtpReceiver.getCapabilities and in the SDP offer but cannot actually
decode the stream, leaving users stuck on a black "Loading video
stream..." screen (#1413).
On Linux desktop we now hide H.265 from the codec dropdown and strip it
from the video transceiver's setCodecPreferences immediately before
createOffer, so the existing server-side resolveCodec naturally
negotiates H.264. No protocol, backend, or persisted-preference changes.
The cloud-api releases endpoint now resolves OTA artifacts under
app/<version>/skus/<sku>/, so each known SKU needs its own folder. Add
an APP_SKUS list (jetkvm-v2, jetkvm-v2-sdmmc) and have both dev_release
and release upload the same jetkvm_app binary (plus .sha256, plus .sig
for production) into every SKU folder. Keep APP_SKUS in sync with
KNOWN_SKUS in cloud-api/scripts/sync-releases.ts.
Show the planned R2 destination paths and SHA256 in the final pre-upload
prompt so the operator can verify destinations before pushing, mirroring
the rv1106-system release_r2.sh pattern. Also relax the existence
pre-flight (rclone lsf | grep -q .) so it catches the new skus/
subfolder layout.
* feat(ota): include device SKU in update requests
Read /etc/jetkvm-sku at startup and pass the value as a sku query
parameter when checking for OTA updates, enabling the cloud API to
serve variant-specific firmware for jetkvm-v2 (eMMC) and
jetkvm-v2-sdmmc hardware. Falls back to "jetkvm-v2" when the file
is absent for backwards compatibility.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(ota): include SKU in auto-update loop
The background auto-update loop in main.go also constructs UpdateParams
and was missing the SKU field, so periodic updates would not transmit
the device SKU to the cloud API.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(logging): reset troubleshooting log level after reboot
Restore WARN on boot so temporary troubleshooting verbosity cannot silently fill device storage before rolling logs land. Update the settings copy to describe the reboot reset, add an e2e regression test for the INFO-to-WARN behavior, and make the i18n resort helper accept lint-staged file arguments.
* fix(i18n): avoid formatter churn in locale files
Keep localization message JSON on the repo's existing resort_messages.py formatting so translation-only changes do not explode into full-file diffs. Remove JSON from the generic oxfmt lint-staged rule and restage the locale files in their canonical format.
Retry relative-only horizontal wheel input after USB re-enumeration and require system 0.2.9 for S3 wake tests so hardware-dependent cases only run where the wake path is expected to work.
Improve the remote-agent e2e helpers to escape SSH commands, time out stuck SSH calls, and retry transient failures. Replace fixed ttyACM sleeps with polling so serial console tests wait for the actual remote host state.
Use relative mouse reports for the S3 wake e2e path because absolute mouse movement is not a reliable wake source on some hosts. This keeps the test aligned with a wake path that passes against the current JetKVM and remote host setup.
* feat(ui): add log level selector in Troubleshooting Mode
Add a UI dropdown in Advanced > Troubleshooting Mode that lets users
set the system log verbosity (Error, Warning, Info, Debug, Trace).
Changes take effect immediately without restart via new
getDefaultLogLevel/setDefaultLogLevel JSON-RPC endpoints.
Also downgrades the noisy wakeup_on_write permission denied warning
from Warn to Debug level, and removes the INFO→WARN config migration
so users can actually select INFO.
Localized for all 14 languages.
* chore(ui): disable no-floating-promises in oxlint
The rule is not actionable for the current codebase; turn it off explicitly.
* refactor(ui): drop void prefixes on JSON-RPC send in advanced settings
no-floating-promises is disabled in oxlint; match the rest of the codebase.
* fix(ui): localize log level dropdown and fix optimistic update
- Replace hardcoded English dropdown labels with localized m.*() calls
- Replace hardcoded error string with m.advanced_error_set_log_level()
- Optimistically update dropdown on change and revert on RPC failure
- Add 6 new i18n keys across all 14 locales
* chore: add remote-agent to .gitignore and auto-sort i18n in pre-commit
- Ignore the compiled e2e/remote-agent/remote-agent binary
- Add lint-staged rule to run i18n:resort on message JSON changes
* copy(ui): improve log level setting description
Apply outcome-oriented copy: explain what the setting does for the
user and when to change it, rather than restating the control's
mechanics. Updated across all 14 locales.
* fix(logging): scope loggers not rebuilt when config level matches base default
UpdateLogLevel compared the new config level against the base default
(ErrorLevel) instead of the previous config level. When switching from
WARN back to ERROR, the comparison was equal so scope loggers kept
their old WarnLevel filter — WRN messages continued appearing despite
the user selecting Error.
Compare against the previous defaultLogLevelFromConfig instead.
* test(logging): add RPC probe for log level filtering
Add a dedicated emitTestLog JSON-RPC method and a focused e2e spec that
verifies live TRACE/DEBUG/INFO/WARN/ERROR filtering against last.log.
* chore(ui): update .gitignore to exclude screenshot.png file
Add two e2e tests that verify JetKVM can wake a host from S3 sleep
using HID input (keyboard and mouse). Tests trigger suspend via
`echo mem > /sys/power/state`, wait for the host to become
unreachable, then send HID reports and verify recovery.
Both tests skip gracefully when system firmware is below 0.2.8
(missing wakeup_on_write kernel support) or when the remote host
doesn't support S3 deep sleep.
Also adds a `semverGte` helper for version comparisons.
rpcWheelReport was unconditionally sending wheel events to both the
absolute and relative mouse HID devices. The host OS sees two separate
USB HID devices each producing a scroll event, so it processes both,
doubling the effective scroll distance (e.g. 6 lines instead of 3 on
Windows).
Send wheel events to the absolute mouse device when enabled, falling
back to the relative mouse device otherwise. This mirrors how pointer
reports already work (absMouseReport vs relMouseReport are separate).
Add an E2E test that verifies exactly one wheel event is received per
wheelReport RPC call when both mouse devices are enabled.
Key-repeat events (fired at ~30Hz by the browser for held keys) were
cancelling and restarting the keepalive interval on every keydown. Since
the repeat rate (~33ms) is shorter than the keepalive period (50ms), the
keepalive tick could never fire. When a second key was pressed and the
modifier's repeat stopped, the modifier's 100ms auto-release timer
expired with no keepalive to extend it.
Fix: start the keepalive interval on first key press and leave it
running undisturbed until all keys are released. Track held keys
client-side via a Set to know when to start/stop the interval.
Also adds six e2e tests covering:
- Key-repeat simulation (rapid repeated presses without releases)
- Modifier held across rapid tap burst (20 keys at 50ms spacing)
- Multiple simultaneous modifiers (Ctrl+Shift+key)
- Reversed release order (modifier up before non-modifier)
- AltGr (AltRight) held while tapping
- Modifier held while tapping 10 keys over 10 seconds
Closes#1386
OTA beforeAll/afterAll hooks were using the global 60s timeout while
performing multi-reboot sequences that need minutes. Add explicit
test.setTimeout(420000) inside each hook.
setEDID RPC can drop the WebSocket on some devices during HDMI re-link.
Tolerate RPC timeouts, reconnect page + WebRTC afterwards, and retry
agent resolution checks with a 15s polling loop.
EBUSY CDROM test used sysfs traversal that broke across kernel/host
variations. Switch to lsblk and skip gracefully when the host doesn't
enumerate USB mass storage as sr* devices.
USB recovery test left the device bricked (initUsbGadget crash loop)
when auto-recovery failed. Add try/catch that re-binds the UDC and
reboots on failure.
OTA reconnectAfterReboot retries increased from 15 to 30 (65s → 95s)
to handle slower devices.
When a browser doesn't support H.265, the filtered codecOptions won't
contain "h265" but the backend may still return it. Fall back to "auto"
so React state matches what the select actually displays.
Remove the detach window feature and replace it with a simpler `?embed`
query parameter that hides the header bar and status bar using the same
settings levers. Embed mode latches into session state so it persists
across in-app navigation.
- Delete useDetachedWindow hook and window tracking logic
- Add `isEmbedMode` to UI store, latched from `?embed` query param
- Embed mode forces hideHeaderBar and hideStatusBar via same code path
as the existing appearance settings
- Replace detach/close buttons with fullscreen split button containing
"Compact Window" option that opens embed view in new window
- Hide settings button and show close button in embed mode
- Simplify useAppNavigation by removing query param threading
- Add action_bar_compact_window i18n key to all 14 locales
The remote host display may enter DPMS sleep during the build/deploy
phase, causing the KVM to report "No HDMI signal detected" when the
remote-agent tests start. Wake the display via DPMS before waiting,
increase the timeout from 15s to 30s, and add a page-reload retry
if the WebRTC session connected before the signal was detected.
Authored-by: Adam Shiervani <adam.shiervani@gmail.com>
setEDID blocks ~7.5s for HDMI renegotiation, which could exceed the
hardcoded 10s RPC timeout. Add configurable timeout to sendJsonRpc and
use 20s for all setEDID calls. Also handle the "Use Here" session dialog
after page reload in beforeAll, and wait for video stream before LED tests.
Vite 8's stricter CJS/ESM interop resolves the default import to the
module namespace object instead of the component, crashing KeyboardWrapper
at render time. Switch to the named `KeyboardReact` export.
Also fix pre-existing floating promise lint warnings in the same file.
* feat(video): tune encoder for better quality and faster recovery
- Reduce GOP from 60 to 30 for faster keyframe recovery on screen changes
- Set u32MinBitRate to half the target to prevent static-screen bitrate collapse
- Reduce u32StatTime from 3s to 2s for tighter rate control adaptation
- Raise minimum bitrate floor from 100 to 200 kbps
* feat(ui): show live bitrate in debug info bar
Poll WebRTC inbound-rtp stats every second and display the current
receive bitrate next to the codec indicator when debug mode is enabled.
* feat(ui): add loading spinner to video quality dropdown
Disable the select and show a spinner while fetching or applying the
stream quality factor, matching the existing EDID selector pattern.
* fix(i18n): remove redundant prefixes from video settings titles
Strip "Video"/"Stream" prefixes from settings headings that are already
under the Video settings page: Stream Quality → Quality, Video Codec →
Codec, Video Enhancement → Enhancement.
* feat(video): add H.265 codec support with auto-negotiation
Add H.265 (HEVC) encoding support to the RV1106 hardware encoder alongside
existing H.264. The codec is negotiated per-WebRTC session based on browser
capabilities.
- Add codec preference setting (Auto/H.265/H.264) to config, RPC, and UI
- Auto mode inspects the browser's SDP offer and prefers H.265 when supported,
with graceful fallback to H.264 for browsers without H.265 (e.g. Firefox)
- Move WebRTC video track creation from newSession() to ExchangeOffer() so
the codec can be resolved after seeing the browser's offer
- Set encoder codec type in onFirstSessionConnected() before VideoStart()
- Show active codec in the status bar when troubleshooting mode is enabled
- Remove quality factor >1.0 ceiling from ctrl.c to allow bitrate testing
- Fix Go wrapper to check return value from C quality factor setter
- Add e2e tests: video quality bitrate measurement, codec negotiation,
codec preference persistence, and a quality factor sweep benchmark
- Add visual noise helpers (remote host terminal) to e2e test infrastructure
* chore(e2e): remove video quality benchmark tests and helpers
Remove video-quality-sweep and video-quality spec files — these are
benchmarking tools, not regression tests. Also removes the visual noise
helpers and hardcoded developer SSH address from helpers.ts.
* feat(video): bump bitrate cap to 4000 kbps and tighten VBR ceiling
- Increase base_bitrate_high from 2000 to 4000 kbps, giving users
better image quality at every quality factor setting.
- Tighten VBR max_bitrate from 2x to 1.5x target, reducing encoder
overshoot while still allowing headroom for dynamic content.
- Add frames dropped, decode time, freeze count to WebRTC test hooks
for pipeline health monitoring.
- Move bitrate sweep benchmark to ui/benchmarks/ with its own
playwright config, separate from the e2e test suite.
Sweep results (visual noise, H.264, 1080p):
factor=0.1: 3082 kbps, 60fps, 0 dropped, 2.9ms decode
factor=0.5: 6357 kbps, 60fps, 0 dropped, 3.6ms decode
factor=1.0: 9445 kbps, 59fps, 0 dropped, 4.3ms decode
Validates that the locally-built binary can accept a GPG-signed OTA
update. Deploys the dev build, then serves the latest production binary
and its real signature via a mock update server. Runs in the regular
test_e2e lane — no signing key required.
The frontend had the old generic default EDID hardcoded, so after the
backend migration to the new JetKVM v1 EDID (with CEA-861 extension,
HDMI vendor block, and audio support), the video settings page couldn't
match it to any preset and incorrectly displayed "Custom".
Verify that setting a custom NTP server via RPC results in the server
being queried (validated through Prometheus metrics), and that an invalid
hostname gracefully falls back to default NTP servers.
Co-authored-by: Adam Shiervani <adam@jetkvm.com>
* feat(network): add custom NTP/HTTP time sync configuration UI
Closes#516, #645, #59
The backend supports custom NTP servers, HTTP URLs, source ordering,
parallel queries, and fallback control for time synchronization, but the
frontend only exposes three presets (NTP only, NTP and HTTP, HTTP only).
Users who need to specify their own NTP server — the core ask in all
three linked issues — have no way to do so through the UI.
Add a "Custom" option to the time sync dropdown. When selected, a card
appears with input fields for NTP servers and HTTP URLs, following the
same list-with-add/remove pattern used by the static IPv4 DNS fields.
This is a simplified alternative to #1102 which exposed every backend
field (source ordering, parallel queries, disable fallback) as direct
UI controls. That PR stalled for 3 months due to complexity concerns
and UX debate. This PR ships the functionality users actually requested
— custom NTP servers — with a minimal UI surface:
#1102: 753 additions, 15 files, new Combobox modifications
This: ~120 additions, 18 files (13 are localization)
The advanced fields (TimeSyncOrdering, TimeSyncParallel,
TimeSyncDisableFallback) retain their backend defaults and can be
surfaced in a follow-up if there is demand.
Backend changes:
confparser.go — add hostname_or_ipv4_or_ipv6 validation type so NTP
server fields accept hostnames like pool.ntp.org, not just raw IPs.
config.go — change TimeSyncNTPServers validation from ipv4_or_ipv6
to hostname_or_ipv4_or_ipv6.
Frontend changes:
CustomTimeSyncCard.tsx — new component with NTP server list and HTTP
URL list, field validation, add/remove controls.
stores.ts — add optional time_sync_ordering, time_sync_ntp_servers,
time_sync_http_urls, time_sync_disable_fallback, time_sync_parallel
to NetworkSettings interface.
network settings page — uncomment Custom option, render card when
time_sync_mode is custom.
Translations added for all 13 supported languages.
* fix(timesync): address review feedback on custom NTP UI
1. filterNTPServers: pass hostnames through instead of dropping
them. net.ParseIP() returns nil for hostnames like
pool.ntp.org, causing them to be silently skipped. The NTP
library handles DNS resolution itself, so hostnames are valid
entries.
2. getSyncMode: when TimeSyncMode is "custom", default the
ordering to [ntp_user_provided, http_user_provided, ntp_dhcp,
ntp, http] so user-provided servers are actually queried. The
previous hardcoded default never included *_user_provided
entries, rendering custom servers unreachable.
3. Stale config pointer: add SetNetworkConfig() on TimeSync and
call it from rpcSetNetworkSettings after config.NetworkConfig
is replaced. Without this, TimeSync holds a stale pointer and
ignores runtime config changes until restart.
4. DNS vacuous truth: guard .every() calls on ipv4/ipv6 DNS
dirty arrays with .length > 0 checks. [].every() returns true
in JS, causing empty DNS arrays to falsely appear in the
confirmation dialog.
Signed-off-by: Alex Howells <alex@howells.me>
* fix(timesync): ensure custom mode uses user-provided servers and re-syncs on settings change
Move TimeSyncOrdering override before the mode switch so "custom" mode
always sets the correct ordering with ntp_user_provided first, preventing
stale ordering values from overriding it. Trigger an immediate time sync
when network settings are saved so users don't have to wait for the
hourly cycle or reboot.
---------
Signed-off-by: Alex Howells <alex@howells.me>
Co-authored-by: Adam Shiervani <adam@jetkvm.com>
* fix(keyboard): serialise keyboard state mutations to eliminate race
keypressReport performed a read-modify-write on keysDownState across
three separate lock acquisitions, allowing concurrent callers (e.g. two
auto-release timers, or an auto-release racing with a session-disconnect
clear) to interleave and produce lost updates — leaving stale keys in
the device state after disconnect.
Replace the per-operation keyboardWriteHidFileLock with a keyboardMutex
that covers the entire read-compute-write-update sequence in both
keypressReport and KeyboardReport. This makes all keyboard state
mutations serialisable, eliminating the race by construction rather than
patching individual call sites.
Also cancel pending auto-release timers on session close (avoids
unnecessary HID writes) and query device state directly via JSON-RPC
in the E2E test (removes Zustand store timing dependency).
* fix(lint): align goimports formatting in config.go
* usb: enable remote wakeup for HID devices
Set bmAttributes to 0xa0 (bus-powered + remote wakeup) in the USB
configuration descriptor, and enable wakeup_on_write on all HID
functions (keyboard, absolute mouse, relative mouse).
Together with the corresponding kernel f_hid patch in rv1106-system,
this allows the JetKVM to wake a sleeping host by sending keyboard or
mouse input through the web UI or API.
Tested on JetKVM v2 waking a Windows 11 host from S3 sleep.
Requires: jetkvm/rv1106-system kernel patch (f_hid wakeup_on_write)
Closes: #120Closes: #674
* fix: ignore errors writing wakeup_on_write for backward compatibility
The wakeup_on_write configfs attribute only exists on kernels with
the rv1106-system#57 patch. On unpatched kernels the attribute is
absent, and writing to it fails, which would break the entire USB
gadget initialization.
Set IgnoreErrors for wakeup_on_write so it is silently skipped on
kernels that lack the attribute.
Linux prevents overwriting a running binary. Move the pkill step
before the scp so the binary is stopped before we copy the new one,
then start it without the redundant kill+sleep.
* fix: add hold-to-force-off hint for ATX Power button (#1040)
* i18n: add atx_power_control_hold_hint translations for all languages
* fix: restore i18n files to proper format, only add atx_power_control_hold_hint key
Previous commits accidentally changed indentation (2-space → 4-space) and
removed 102 keys from all locale files. This restores the original formatting
and content, adding only the new atx_power_control_hold_hint translation.
* fix: send mouse button state changes via reliable WebRTC channel (#695)
When holding one mouse button and pressing another without moving the mouse,
only pointerdown/pointerup events fire (no mousemove to self-correct). These
button-only state changes were sent via the unreliable WebRTC data channel
(maxRetransmits: 0), and lost packets were never recovered.
Changes:
- useHidRpc.ts: Track last button state and send button changes via the
reliable channel. Movement-only events continue using the unreliable
channel for low latency, since lost movement packets self-correct via
subsequent mousemove events.
- e2e/remote-agent/main.go: Fix omitempty on InputEvent.Value so button
release events (value=0) are included in JSON responses.
- ra-all.spec.ts: Add E2E test that holds left mouse button, presses and
releases right mouse button, and verifies all 4 button events arrive
on the remote host (20 iterations).
* fix: rebuild remote agent when source changes to prevent stale deploys
ensureDeployed() skipped rebuild and redeploy when the agent was already
running, causing the omitempty fix on InputEvent.Value to never reach
the remote host. Now compares source mtime against binary mtime and
forces redeploy when a rebuild occurs.
* fix(video): scale stream to fill available viewport
The video element uses max-h-full and max-w-full which cap the rendered
size at the stream's intrinsic resolution but never scale it up. On
monitors larger than the stream resolution (e.g. 5120x2160 viewing a
1920x1080 stream) the video occupies a fraction of the available space
with large margins around it.
Replace max-h-full max-w-full with h-full w-full so the video element
fills its container in both dimensions. object-contain is retained so
aspect ratio is preserved with letterboxing/pillarboxing as needed.
The absolute mouse coordinate math in useMouse.ts already accounts for
object-contain scaling by computing effective display area from
videoClientWidth/Height vs videoWidth/Height, so mouse mapping remains
correct at any scale factor.
Drop the sm:min-h-[384px] sm:min-w-[512px] minimum size constraints
which are no longer needed when the video fills available space.
Fixes#121
* fix(video): scale stream to fill available viewport without letterboxing
---------
Co-authored-by: Adam Shiervani <adam.shiervani@gmail.com>
* fix: add hide text toggle to paste modal (#694)
* fix: move paste modal hide/show text toggle to top-right above input (#694)
* fix: inline hide/show toggle into input labels and fix lint warnings
* i18n: add paste modal hide/show text translations for all locales
* fix: use CSS text-security instead of password input to preserve newlines
* i18n: translate scroll invert strings for all locales
* fix: hide invalid character details when text is hidden in paste modal
* fix: buffer HID response channel and reduce timeout to prevent goroutine leaks (#1154)
* fix: remove goroutine from HID message handler to prevent leak and disconnect race (#1154)
The goroutine+select pattern in onHidMessage leaked permanently when
timeouts fired (unbuffered channel, no reader). On the single-core
RV1106, boot-time CPU contention cascaded these leaks, causing
persistent mouse latency until reboot.
Processing synchronously is safe — every path in handleHidRPCMessage
is already bounded (10ms HID write deadline, cancellable macros,
non-blocking DataChannel sends). This also eliminates a race where
timed-out goroutines could overwrite the all-keys-up report on
session disconnect.
---------
Co-authored-by: Adam Shiervani <adam@shiervani.com>
Add 8 baseline tests for the keepalive/auto-release code path with
timings matched to the actual Go constants (100ms DefaultAutoReleaseDuration,
50ms keepalive interval, 100ms baseExtension).
Tests cover: held key survival with keepalives, auto-release without
keepalives, window blur release, arrow key hold, modifier+key combos,
simultaneous keys, rapid tap cycles, and long (2s) holds.
* fix: reset USB gadget when virtual media unmount fails with EBUSY (#834)
When unmountImageLocked() gets EBUSY from the kernel (host OS still
accessing the virtual disk via PREVENT MEDIUM REMOVAL), fall back to
gadget.RebindUsb(true) to force-disconnect the host, then retry the
unmount. Uses RebindUsb directly instead of UpdateGadgetConfig to avoid
hitting the same EBUSY when writing configfs attributes before rebind.
After rebind, properly reopen keyboard HID file (ResetHIDFiles + sleep +
OpenKeyboardHidFile) matching the pattern in setMassStorageMode().
Also propagate unmount errors to RPC callers and only clear
currentVirtualMediaState after the unmount actually succeeds.
Adds E2E test that mounts an ISO on the remote host to trigger PREVENT
MEDIUM REMOVAL, then verifies unmount succeeds and keyboard recovers.
* fix: recover HID chardev after DWC3 rebind race on RV1106
The DWC3 USB controller on the RV1106 has a race condition where rapid
unbind→bind of the UDC can permanently corrupt HID chardev state —
/dev/hidg0 returns ENXIO even though the device node exists and the UDC
shows "configured". This can be triggered by UpdateGadgetConfig's
transaction rebind and by host-initiated USB device resets during mass
storage media changes.
Three-part fix:
1. rebindUsb(): after binding, verify /dev/hidg0 is openable. If not,
unbind again with a 100ms pause for kernel cleanup, then rebind.
2. setMassStorageMode(): pre-set recovery timer before UpdateGadgetConfig
to prevent the poller from interfering. After the 1s sleep, if
OpenKeyboardHidFile fails, do a corrective RebindUsb + retry.
3. checkUSBState() poller: when a state transition occurs and
OpenKeyboardHidFile fails, trigger a corrective rebind to recover
from host-initiated USB resets that corrupt the chardev.
* fix: suppress USB recovery poller before rebind in unmount and mode-change paths
The auto-recovery poller could see transient "not attached" UDC state
during RebindUsb and trigger a competing rebind, corrupting HID chardev
state. Add setUSBRecoveryTimer calls before the rebind in
unmountImageLocked and before the corrective rebind in setMassStorageMode.
* test: replace blind sleep with two-phase wait in factory-reset e2e test
Wait for device to become unreachable before polling for it to come back,
preventing false passes from stale pre-reset responses.
* refactor: simplify branch — extract helpers, remove duplication, fix flaky tests
- Extract rebindAndRecoverHID() in Go to deduplicate USB recovery sequences
- Remove redundant setUSBRecoveryTimer() call after UpdateGadgetConfig()
- Extract waitForKeyboardReady() helper replacing 5 duplicate retry loops
- Consolidate 3 duplicate remoteExec definitions into single remoteHostExec()
- Use shared SSH_OPTS from helpers.ts instead of hardcoded SSH options
- Fix remote agent omitempty on mouse X/Y causing undefined in TypeScript
- Poll keys-down state in disconnect test to avoid race condition
* fix: remove dead IsHidgChardevHealthy export, reset HID files before rebind
- Remove unused exported IsHidgChardevHealthy wrapper (only the unexported
isHidgChardevHealthy is called, inside rebindUsb)
- Move ResetHIDFiles() before RebindUsb in checkUSBState so stale file
handles are closed even if the rebind fails — prevents silent mouse
write failures on dead inodes after a successful unbind + failed bind