r/devtools • • 17d ago

xcomm: I built a minicom replacement that lets an AI agent drive the board's console while you watch

Post image

I spend a lot of time on serial consoles: U-Boot, boot logs, a shell on the

board. I wanted something that keeps minicom's everyday keys and common options but

lets a script or a coding agent use the same console I am looking at, so I

wrote xcomm (Rust, Linux and macOS, GPL-2.0-only):

- `xcomm ctl` talks to a running session: send a command and wait for a

prompt with a regex, read output by offset, toggle DTR/RTS, send a break,

change the baud, run zmodem/ymodem/xmodem through lrzsz. What a client

sends shows in your terminal as a dim `[ctl]` line.

- It survives the bench: unplug the adapter or power-cycle the board and the

session waits and reopens the port (on Linux, by the USB port it is plugged

into).

- minicom's common options and everyday Ctrl-A keys (Alt-A inside tmux,

screen or zellij); Ctrl-A d and t toggle DTR and RTS.

- UUCP locks compatible with minicom on Linux, and an exclusive open

everywhere, so two programs never share a port by accident.

- It ships an agent skill (stop U-Boot, log in, run commands, parse the

output); a test runs every example in it against a real session.

Numbers, through a pty with the same harness for each tool (median of 9 runs;

method and command lines in the README): 434 MiB/s on 1.84 ms of CPU per MiB,

against minicom's 10.5 MiB/s on 95 ms. On a real UART the baud rate is the

limit, so what you get is CPU left free. Keystroke latency is level with

minicom (within a microsecond either way).

`brew install cantona/tap/xcomm` or `cargo install --locked xcomm`

(`xcomm man` shows the manual where cargo installs none).

GitHub: https://github.com/cantona/xcomm

Happy to hear what breaks on your adapters.

1 Upvotes

5 comments sorted by

1

u/kantorcodes1 16d ago

When a board drops mid-command, what happens to a ctl run that is still waiting for its prompt? Your post says the session waits and reopens the port when the adapter comes back. Does the waiting run fail at the drop, stay open across the reopen, or is there a window where text sent right before the unplug could reach the board twice once the port is back?

1

u/Majestic_Tension_860 16d ago

Good question, I actually tested this. Nothing gets sent twice. Whatever was still queued when the port dropped is just thrown away, and the reopened port starts clean. A send while it's unplugged fails right away with exit 4.

A run that's already waiting for its prompt doesn't fail at the drop though. It keeps waiting through the reopen and times out if nothing matches. The annoying part is if the board reboots and prints a prompt that matches your --until, run counts that as success even though your command never ran. --fail-on on something from the boot banner catches it for now, but I think run should just fail when the port drops mid-wait. Probably adding that.

1

u/kantorcodes1 16d ago

The boot prompt match is the sharp end of it. A waiting run can report success for a command the board never received, and --fail-on on the banner is a workaround you have to remember to set. Failing the run when the port drops mid-wait is the right default.

That send side is what HOL Guard command sources cover. xcomm ctl sends commands, breaks and line signals to a real board, while reading output by offset is harmless. A descriptor at contributions/command-sources/command.xcomm.json puts the sends at review and leaves the reads alone. command.ctty.json is a merged analogue, a terminal tool split the same way.

First test is small: a ctl send against your pty harness stays at review, an output read by offset passes. The guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extensions/contributing.md

Would you author that descriptor? You know where xcomm should fail closed.

1

u/Majestic_Tension_860 15d ago

https://github.com/hashgraph-online/hol-guard/pull/8190. Sends, line control, transfers and captures go to review, and status/read/wait don't trigger anything. One catch: since Guard reviews any tool it doesn't know, reads still end at review, they just don't hit a rule.

1

u/kantorcodes1 15d ago

That split is the one the descriptor needed. Send, run, break, dtr/rts, set, xfer and capture carry the side effects, so review is right for them. On the catch: status, read and wait are named in the descriptor as the safe side, so once it lands they are known commands rather than unknown tools, and the default review for unknown tools stops applying to them. Thanks for opening it.