Conversation
4 of 5 tasks
conallob
force-pushed
the
claude/lucid-ramanujan-mgonmf
branch
from
September 27, 2026 01:04
176f9a6 to
2a794ad
Compare
With the Serial Console extension loaded, the UART on the extension port can now also be reached over the network, in one of two modes: - ser2net: a TCP listener (default port 2217), either raw or telnet with RFC 2217 so clients such as pyserial's rfc2217:// can set the baud rate, data bits, parity and stop bits. A client's line settings last only for its session. IAC BREAK sends a serial break. There is no authentication, and the UI says so. The listener honours the loopback-only setting. - web: an authenticated WebSocket at /serial/ws (the usual auth cookie, same-origin only) behind a standalone full-page console at /serial, so the UART is usable without a WebRTC KVM session. Both modes go through the existing SerialMux, which stays the only reader and writer of /dev/ttyS3. UART reads fan out to network clients through a hub that never blocks the reader; a client that falls behind by 256 reads is disconnected. Concurrent clients are capped (1 by default, up to 8). getSerialNetworkStatus reports the listener, errors and connected clients, and Prometheus exports client counts and relayed bytes. The settings live in serialSettings.json with the other Serial Console settings; older files get the new defaults (disabled). Also: - The stored Serial Console settings are now applied at boot when the extension is loaded, not when the UI next opens it. - A missing serialSettings.json no longer fails getSerialSettings. - SerialMux.Enqueue no longer blocks forever once the mux is closed. Refs jetkvm#1520 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C3BNwaCJdCFHEuH7EZcR7j
A collector reports the extension port UART's state at scrape time:
- jetkvm_serial_port_open{device}
- jetkvm_serial_port_info{device,baud_rate,data_bits,parity,stop_bits,extension}
- jetkvm_serial_port_baud_rate{device}
- jetkvm_serial_network_info{mode,protocol,listen_address}
- jetkvm_serial_network_up{mode}
- jetkvm_serial_network_max_clients
go.bug.st/serial can't read back the port's mode, so every open, close
and SetMode now goes through setSerialPortMode and a small tracker.
The metrics then show what the port is actually running at, including
settings an RFC 2217 client applied for its session, and the info
series is dropped rather than left stale when the port closes.
setSerialPortMode also checks for a port that failed to open, which
the ATX and DC extension mounts did not.
The collector test uses client_golang's testutil, which adds
kylelemons/godebug as an indirect module requirement (already in
go.sum).
Refs jetkvm#1520
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C3BNwaCJdCFHEuH7EZcR7j
CI runs `go test ./...` on an amd64 runner. Every existing test in the
root package is tagged linux && arm, so the root package never had to
link there; the new untagged serial tests made it link against the
device-only libjknative and liblvgl, and the "Run tests" step failed:
/usr/bin/ld: cannot find -ljknative
FAIL github.com/jetkvm/kvm [build failed]
The telnet/RFC 2217 codec, the UART fan-out hub, the TCP and WebSocket
server and the metrics collector don't need the device, so they move
to internal/serialnet with their tests, which then run in CI like the
other internal packages. The root package keeps the device wiring:
settings, the SerialMux feed, port mode changes, RPCs, the /serial/ws
handler and collector registration. The server's hooks into the port
are passed in as serialnet.Deps. No behaviour change.
Refs jetkvm#1520
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C3BNwaCJdCFHEuH7EZcR7j
conallob
force-pushed
the
claude/lucid-ramanujan-mgonmf
branch
from
September 27, 2026 01:10
2a794ad to
06f4026
Compare
|
is this in a state you'd like someone to try it on real hardware? i'd be happy to give it a go if you're ready / if you've got instructions for that! :) |
Author
|
@justarandomgeek I believe it's ready to test on hardware. I need to set up one of my newer PoE KVMs for experimenting before I start testing on hardware though Depending on which generation you have, #1536 may be a factor when testing though |
|
yeah i have the PoE one, and i've already got the serial cable made up for it to the common adapter i use for everything, i just need to lay my hands on one more ethernet cable than i had, apparently... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1520
Summary
With the Serial Console extension loaded, the extension port UART (
/dev/ttyS3) can be reached over the network. A new Network Access setting offers Disabled (default), ser2net (TCP) or Web console. A JetKVM, or a rack of them, can then act as a serial console server without developer mode, SSH or an external daemon.ser2net mode: a TCP listener built into the app. Port is configurable (default 2217) and so is the protocol:
socat -,raw,echo=0 tcp:<ip>:2217).IAC BRKsends a real serial break (e.g. SysRq). RFC 2217 clients such as pyserial'srfc2217://can change baud rate, data bits, parity and stop bits for their session; the configured settings come back when they disconnect.Web mode:
GET /serial/wsuses the existing auth middleware and cookie, with the WebSocket library's default same-origin check, so another site can't use the cookie to reach the UART. Frames carry raw UART bytes in both directions. A new device-only route,/serial, is a full-page xterm console on top of it, so the UART works in a plain browser tab without a WebRTC KVM session. The extension panel has an "Open Web Console" button.Design
SerialMux, which stays the only reader and writer of the port. This fixes the problem described in the issue, where a second process (microcom) lost most reads tojetkvm_app. Network clients subscribe to that one reader, so each client gets every byte.SerialMuxbeforeConsoleBroker, so they get no line splitting,RX:/TX:labels or control-character rewriting. Terminals,expectscripts and full-screen ANSI output work unchanged. The in-session WebRTC console is unaffected.serialSettings.jsonwith the other Serial Console settings. Older files get the defaults, so the feature is off after upgrade.getSerialNetworkStatusreports whether it is running, the listen address, any bind error and the connected clients. The UI polls it.Prometheus metrics
jetkvm_serial_port_opendevicejetkvm_serial_port_infodevice,baud_rate,data_bits,parity,stop_bits,extensionjetkvm_serial_port_baud_ratedevicejetkvm_serial_network_infomode,protocol,listen_addressjetkvm_serial_network_upmodejetkvm_serial_network_max_clientsjetkvm_serial_network_clientstransportjetkvm_serial_network_bytes_totaltransport,directionPort and network metrics are computed when Prometheus scrapes.
go.bug.st/serialcan't report a port's current settings, so every open, close and mode change now goes throughsetSerialPortMode, which records them. The metrics show what the port is actually running at, including a session-only RFC 2217 change, and the info series disappears rather than going stale when the port closes.Related fixes
serialSettings.jsonno longer makesgetSerialSettingsreturn an error; the defaults apply.SerialMux.Enqueueno longer blocks forever after the mux is closed./dev/ttyS3failed to open no longer panics. This also covers the ATX and DC extension mounts.Out of scope
Testing
serial_server_test.goandserial_metrics_test.gohave no build tag, so they run in amd64 CI. They cover:The server tests pass 30 runs in a row under
-race.go vetandgolangci-lint(repo config): 0 issues.UI:
tsc,oxlint(no new warnings),oxfmt.Tried
/serialin Chromium against a mock backend: it connects, shows UART output, and typed input round-trips.Not yet tested on hardware against a real
/dev/ttyS3, andmake test_e2ehasn't been run.Checklist
make test_e2elocally and passed (needs a device; not yet run)