Fix AX.25 terminal: mod-128 inbound decode and Ctrl-] menu#487
Merged
Conversation
chrissnell
force-pushed
the
feature/terminal-mod128-rx-and-menu-shortcut
branch
2 times, most recently
from
July 23, 2026 05:32
a01c022 to
ef7d8f4
Compare
Two connected-mode terminal bugs surfaced against a packet BBS (#456): Inbound frames for a mod-128 (SABME) session were decoded with a fixed mod-8 modulus in the RX fanout, corrupting N(S)/N(R) so no frame after the handshake was delivered. Route inbound bytes through a new Manager.DispatchRaw that resolves the session first and decodes with its negotiated modulus (read race-free via an atomic mirror). Decode now also sizes the control field correctly under mod-128, where U-frames stay 1 octet while I/S frames are 2 -- the old blanket 2-octet assumption rejected the UA that completes the handshake. The Ctrl-] command-bar shortcut never fired while the terminal canvas had focus: xterm maps Ctrl-] to the GS control code and calls stopPropagation, so the window-level keydown handler never saw it. Intercept the chord via attachCustomKeyEventHandler so xterm surrenders the key (no stray 0x1D down the link) and the command bar opens; the window handler stays as the out-of-focus fallback. Adds a mod-128 delivery regression test and documents the modulus-aware-decode invariant in the wiki.
chrissnell
force-pushed
the
feature/terminal-mod128-rx-and-menu-shortcut
branch
from
July 23, 2026 05:57
ef7d8f4 to
7597a1f
Compare
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.
Fixes two connected-mode AX.25 terminal bugs reported on #456 (IC-705 over USB to a packet BBS).
1. mod-128 (SABME) sessions: no inbound frames after the handshake
pkg/app/rxfanout.godecoded every inbound connected-mode frame with the modulus hardcoded to mod-8 (ax25conn.Decode(rf.Data, false)). A mod-128 link's I/S frames carry a 2-octet control field, so decoding them as mod-8 corruptsN(S)/N(R)and the session drops every frame -- the operator sees the BBS welcome, then nothing.Manager.DispatchRawresolves the owning session from the (modulus-independent) address header, reads its negotiated modulus race-free via a newSession.Mod128()atomic mirror, then decodes.Decodenow sizes the control field correctly under mod-128: U-frames (SABM/SABME/UA/DM/DISC/...) stay 1 octet, only I/S grow to 2. The old blanket 2-octet assumption rejected the UA that completes the handshake with "missing control field" -- caught while adding the regression test.The web terminal exposes a "Negotiate modulo-128 (SABME)" toggle, so this path is reachable in production. (Not the specific failure jfbabb hit -- his mod-8 welcome arrived -- but a real correctness bug on the same feature.)
2. Ctrl-] / Cmd-] command bar never opens while the canvas has focus
The shortcut lived only on
<svelte:window onkeydown>, but xterm maps Ctrl-] to the GS control code (0x1D) and callsstopPropagation()on that keydown, so the window handler never fires. Since the canvas auto-focuses, the shortcut was effectively dead -- browser-agnostic, matching both the Safari and Firefox reports.Fix intercepts the chord via
term.attachCustomKeyEventHandler, returningfalseso xterm leaves the key alone (no stray0x1Ddown the link) and the command bar opens directly. The window handler stays as the out-of-focus fallback.Still open (needs operator data, not in this PR)
The primary #456 symptom -- link falls to
TIMER_RECOVERYafter the first typed command while the BBS keeps sending -- points to the half-duplex soundcard RX turnaround, not the state machine. Awaiting a log capture + PTT/tail config before touching modem timing.Verification
go build ./...,go vet ./pkg/ax25conn/... ./pkg/app/...-- clean.go test -race ./pkg/ax25conn/...andgo test ./pkg/app/...-- pass, including the newTestManager_DispatchRawMod128Delivers(end-to-end mod-128 handshake + I-frame delivery).node_modulesin this environment to build locally).Wiki: adds invariant #60 (modulus-aware inbound decode + variable mod-128 control width).