Syntax
Global Options
Commands
Command Reference
List Nets (Default)
List all saved nets on a Lager Box. This is the default behavior when no subcommand is provided.
The
Script column only appears if any debug net has a J-Link script attached.
Example Output:
add
Create a new net by specifying its name, type, channel, and instrument address.
NAME- Unique name for the net (e.g.,supply1,debug_main)ROLE- Type of net:power-supply,battery,solar,debug,adc,dac,gpio,scope,eload,uart,usb,camera,arm,watt-meter,thermocouple,i2c,spi. The legacy tokenssupplyandbattare accepted as input aliases and normalized topower-supply/battery— saved nets always carry the canonical role.CHANNEL- Channel identifier (e.g.,1,AIN0,FIO0,STM32F4,0)ADDRESS- VISA address or device path (e.g.,TCPIP::192.168.1.100::INSTR)
--box TEXT- Lager Box name or IP--jlink-script FILE- J-Link script file for debug nets (stored on box)--sda PIN/--scl PIN- Custom LabJack pins fori2cnets--cs PIN/--sck PIN/--mosi PIN/--miso PIN- Custom LabJack pins forspinets
FIO0-FIO7, EIO0-EIO7, CIO0-CIO3, MIO0-MIO2) or raw DIO numbers (0-22). When pin options are given, the CHANNEL argument is ignored — pass custom. If a chosen pin overlaps another saved LabJack net, a warning is printed but the net is still created. --cs is optional: omit it for 3-pin SPI with manual chip select.
Examples:
The
--jlink-script option is only applicable for debug nets. If used with other net types, a warning is printed and the option is ignored.- Net names must be globally unique across all types
- The (role, instrument, channel, address) tuple must match a connected instrument
- Channel binding follows the per-instrument rules described in Channel & Role Constraints below
Channel & Role Constraints
Different instrument families bind nets to channels differently. Lager classifies every supported instrument into one of three categories and enforces the rules consistently acrossadd, add-all, and the TUI.
1. Multi-channel instruments
Instruments with physically independent outputs / inputs. Each channel is its own circuit and can host its own net.
Rule: at most one net per
(instrument, address, role, channel) tuple. Two nets that share (instrument, address, role) but differ in channel are fine — that’s exactly what multi-channel is for.
2. Single-channel, multi-mode instruments
Instruments with one physical channel that can run in one of several modes but not multiple modes at once. The role tells the box which firmware mode to flip the chip into.
Rule: at most one net per
(instrument, address). Once any role is saved on the chip, every other role disappears from the add list. To switch modes, delete the existing net first.
These chips are tracked in _SINGLE_CHANNEL_INST (Keithley, EA) and _MODE_EXCLUSIVE_INST (FTDI_FT232H) in cli/commands/box/nets.py and cli/commands/box/net_tui.py.
3. Single-role debug probes
Standalone debugger boxes — one probe drives one target MCU.
Rule: at most one
debug net per (instrument, address).
4. Multi-channel FTDI debug adapters
FT2232H (2 channels: A, B) and FT4232H (4 channels: A, B, C, D) physically expose multiple USB interfaces. Channels A and B have an MPSSE engine; on the FT4232H, C and D do not. That matters per net type, not per chip. debug, spi and i2c are MPSSE protocols, so they are limited to A and B. gpio runs as asynchronous bitbang, needs no MPSSE, and works on all four. The user picks an interface per net.
Debug nets encode the channel in the device field:
@A/@0, @B/@1, @C/@2, @D/@3. Devices without an @ suffix default to the interface OpenOCD’s interface config picks (typically channel A).
GPIO, I2C and SPI nets take the channel as params.interface on the net record, accepting the same vocabulary as the @ suffix: A-D or 0-3. A net with no interface uses channel A, the only choice on a single-channel FT232H.
Lager enforces which channels are legal per net, not per instrument. If you ask for C or D on an i2c or spi net, net construction fails and names the channel. The failure does not come from somewhere inside pyftdi. A gpio net can use any channel the part has.
Before v0.43.0 all three drivers hardcoded interface A. A board that wires comms to one channel and control lines to another was therefore impossible to drive.
UART nets distinguish channels by their tty path. The USB scanner enumerates every /dev/ttyUSB<N> bound to the chip’s USB serial. Each one shows up as a separate add-list entry, so on an FT4232H you will see up to four UART options.
Rule: a debug net is unique per (instrument, address, channel-suffix). So a single FT2232H can host:
- one
debugnet on@A - one
debugnet on@B - one
uartnet on a/dev/ttyUSB<N>belonging to whichever channels you didn’t claim for MPSSE - one each of
spi/i2c/gpio, each on a channel you name — see below
debug@A and a spi net on interface A); the box doesn’t validate that today.
Quick decision table
add-all
Automatically create nets for all available channels on all connected instruments. This is useful for quickly setting up a new Lager Box.
--box TEXT- Lager Box name or IP--yes- Skip confirmation prompt
add-batch
Create multiple nets from a JSON file for efficient bulk setup.
JSON_FILE- Path to JSON file containing net definitions
--box TEXT- Lager Box name or IP
assign
Assign a USB-serial cable to a known instrument the box cannot auto-detect.
Some instruments have no USB control port. You reach such an instrument over
RS-232 through a generic USB-serial adapter — a Rigol DP711 power supply
behind a Prolific cable, for example. The box sees only the adapter (a uart
device), not the instrument behind it. assign records “this cable is the
DP711’s serial line” on the box. From then on, the scanner reports the
instrument itself. It appears in lager instruments and in the TUI, and you
can create nets for it with lager nets add like any auto-detected device.
Assign once per cable; the assignment is stored on the box and survives
reboots and replugs. Creating nets stays the normal, repeatable step.
End-to-end example (Rigol DP711):
--as-net, the command prints the exact lager nets add invocation
for the new instrument:
- The cable must be plugged in to assign it — its USB identity (vendor/product ID) is captured from the live device.
- Nets for assigned instruments use a durable
serial://<vid>:<pid>/serial/<s>(or.../port/<p>) address instead of a/dev/ttyUSB*path, so they survive tty renumbering, reboots, and port moves. - While a cable is assigned, it is no longer offered as a generic UART device — the serial line belongs to the instrument.
Some cheap USB-serial clones share one serial number (or have none). If
assign reports multiple matching cables, pin the assignment to a physical
box port with --port instead. The trade-off is that if you move the cable to
a different port, the assignment breaks.serial://
address are deleted automatically and reported in the output. The same cascade
applies when you re-assign a cable to a different instrument, and when you
switch its identity from --serial to --port. Only a baud-only re-assign
keeps the existing nets.
Currently assignable devices: Rigol DP711 (single-channel RS-232 power
supply). Run lager nets assign --list to see the catalog your box supports.
delete
Delete a specific net by its name and type.
NAME- Name of the net to deleteNET_TYPE- Type of the net (supply, debug, adc, i2c, spi, etc.)
--box TEXT- Lager Box name or IP--yes- Skip confirmation prompt
delete-all
Delete all saved nets on a Lager Box. This is a dangerous operation.
--box TEXT- Lager Box name or IP--yes- Skip confirmation prompt
rename
Rename an existing net.
NAME- Current name of the netNEW_NAME- New name for the net (must be unique)
--box TEXT- Lager Box name or IP
tui
Launch an interactive terminal-based UI for managing nets. The TUI provides a visual interface for viewing, creating, and deleting nets.
--box TEXT- Lager Box name or IP
- Browse all connected instruments and their channels
- Create new nets with guided prompts
- Pick custom LabJack pins when you add an
i2corspinet. A pin dialog opens with the defaults preselected (I2C: SDA=FIO4/SCL=FIO5; SPI: CS=FIO0/SCK=FIO1/MOSI=FIO2/MISO=FIO3). You can choose any DIO pin per signal, and you can set CS to none for 3-pin SPI. A pin already used by a saved net shows a warning - Assign custom serial devices (RS-232 instruments) to their USB cables — the
interactive twin of
assign, including the optional create-the-net step (--as-net) - Delete existing nets
- View net details and instrument information
- Keyboard navigation
set-script
Attach a debug script — either a JLinkScript or an OpenOCD .cfg/.tcl — to an existing debug net. The file is stored on the box and used automatically during connect, flash, erase, and reset operations.
The backend (J-Link vs. OpenOCD) is auto-detected from two signals:
- The probe’s USB VID on the net’s
addressfield (J-Link →jlink; ST-Link, FTDI, CMSIS-DAP, etc. →openocd). - The file — extension first (
.JLinkScript→ jlink;.cfg/.tcl/.ocd→ openocd), with a content sniff as a tie-breaker for extensionless files or stdin.
set-script refuses with a clear error and asks you to pick one via --backend.
A debug net only carries one script at a time. If the other field is already set, set-script clears it and prints a yellow notice on stderr so nothing disappears silently.
NAME- Name of the debug netSCRIPT_PATH- Path to the script file, or-to read from stdin
--backend [jlink|openocd]- Force a specific backend instead of auto-detecting (required if the probe and file disagree)--box TEXT- Lager Box name or IP
remove-script
Remove the debug script (J-Link or OpenOCD) attached to a debug net.
NAME- Name of the debug net
--backend [jlink|openocd]- Only remove the named backend’s script (default: remove whichever is set)--box TEXT- Lager Box name or IP
show-script
Display the contents of the debug script attached to a debug net. The script content is written to stdout, so > out.cfg works. A one-line summary like # OpenOCD config, 1247 bytes is written to stderr. That tells you which backend’s script you see, and it does not pollute a redirect.
NAME- Name of the debug net
--backend [jlink|openocd]- Only show the named backend’s script (default: show whichever is set)--box TEXT- Lager Box name or IP
show
Display all fields of a saved net, including user-provided metadata (purpose,
notes, tags) set with describe.
NAME- Name of the net
--json- Output as raw JSON--box TEXT- Lager Box name or IP
describe
Set metadata on a saved net so AI agents (and humans) understand what the net does
on the DUT. Introduced in lager 0.24.0; the fields feed agent-assisted testing
via the MCP server. At least one of --purpose,
--notes, or --tag (or --clear-tags) must be provided.
NAME- Name of the net
-p,--purpose TEXT- One sentence: what this net does on the DUT-n,--notes TEXT- Optional notes (gotchas, jumper positions, scope probe points)-t,--tag TEXT- Tag for categorisation/matching (repeatable)--clear-tags- Remove all existing tags before adding new ones--box TEXT- Lager Box name or IP
Net Types Reference
Debug Script Workflow
Both J-Link and OpenOCD debug probes can carry a custom script for handling reset sequences, clock initialization, board-specific signal pinning, or other device-specific behavior. Lager stores one script per debug net — either a JLinkScript or an OpenOCD.cfg/.tcl, never both. It applies that script automatically during connect, flash, erase, and reset operations.
.lager config file:
set-script) and a project-level script (via .lager config) exist, the project-level script takes priority.
Examples
Notes
- Net names are globally unique regardless of type
- Use
lager instruments --box <lager-box>to see available instruments and channels - The TUI provides the easiest way to set up nets for the first time
- Use
add-allto quickly configure a new Lager Box with sensible defaults - I2C and SPI nets are supported on LabJack T7 and Aardvark adapters
- Debug scripts (both J-Link and OpenOCD) are base64-encoded for storage and decoded automatically during debug operations
- A debug net carries at most one script (
jlink_scriptoropenocd_config);set-scriptenforces this by clearing the other field when present

