Skip to main content
The Lager Command-Line Interface (CLI) provides a powerful and scriptable way to interact with your Lager Box and connected hardware directly from your terminal. It is the ideal tool for manual control, shell scripting, and integration into CI/CD pipelines.

Core Concepts

The CLI follows a standard GROUP COMMAND structure. Most commands operate on a specific Lager Box (Lagerbox), which is specified using the --box option.
# General command structure
lager [GLOBAL_OPTIONS] <GROUP> <COMMAND> [ARGS]...

# Example: Read an ADC value from a specific Lager Box
lager adc SENSOR_1 --box my-lager-box

# Example: Set power supply voltage
lager supply VDD_MAIN voltage 3.3 --box my-lager-box

Nets

Most hardware commands operate on nets - named abstractions representing physical test points or signals. Nets map friendly names to instrument channels.
# List available nets
lager nets --box my-lager-box

# Use a net in a command
lager supply supply1 voltage 3.3 --box my-lager-box

Key Command Groups

Below is a summary of the main command groups available in the Lager CLI.

Lager Box Management

  • Boxes: Manage Lager Box configurations (add, delete, sync, import/export)
  • Hello: Verify connectivity to your Lager Box
  • Update: Update Lager Box software
  • SSH: Direct SSH access to Lager Box
  • Logs: View Lager Box service logs

Configuration

  • Instruments: List connected test equipment
  • Nets: Create and manage nets (test point abstractions)
  • Defaults: Set default Lager Box and net configurations

Power & Simulation

  • Supply: Control programmable power supplies
  • Battery: Simulate battery characteristics (SOC, voltage, capacity)
  • Solar: Control solar panel simulators
  • E-Load: Control electronic loads (CC/CV/CR/CP modes)
  • Watt: Read power consumption from watt meters

Measurement

  • Scope: Control oscilloscopes for waveform capture
  • Logic: Control logic analyzers with protocol decoding
  • ADC: Read analog voltage values
  • Thermocouple: Read temperature sensors

I/O & Communication

  • GPI: Read digital inputs
  • GPO: Write digital outputs
  • DAC: Analog output voltage control
  • UART: Serial communication
  • USB: USB port power control
  • BLE: Bluetooth Low Energy scanning

Development

  • Debug: Flash firmware, GDB server, memory access, RTT logging
  • Python: Execute Python scripts on Lager Box
  • Binaries: Run custom binaries on Lager Box

Utilities

  • Webcam: Video capture and streaming
  • Arm: Control robotic arm positioning

Example: Test Script Workflow

This example shell script demonstrates a typical hardware test workflow.
#!/bin/bash

# Define variables
LAGER_BOX="my-test-rig"
FIRMWARE_PATH="build/my_app.hex"
VOLTAGE_NET="supply1"
SENSOR_NET="adc1"

# 1. Flash the latest firmware
echo "--> Flashing firmware..."
lager debug flash --hex "$FIRMWARE_PATH" --box "$LAGER_BOX"

# 2. Power on the DUT
echo "--> Enabling power..."
lager supply "$VOLTAGE_NET" voltage 3.3 --box "$LAGER_BOX" --yes
lager supply "$VOLTAGE_NET" enable --box "$LAGER_BOX"
sleep 2

# 3. Take a sensor reading
echo "--> Reading sensor..."
READING=$(lager adc "$SENSOR_NET" --box "$LAGER_BOX")
echo "Sensor reading: $READING V"

# 4. Check if value is within expected range
if (( $(echo "$READING > 1.0" | bc -l) )) && (( $(echo "$READING < 2.0" | bc -l) )); then
    echo "PASS: Value within expected range"
else
    echo "FAIL: Value out of range!"
    exit 1
fi

# 5. Power down
echo "--> Disabling power..."
lager supply "$VOLTAGE_NET" disable --box "$LAGER_BOX" --yes

echo "--> Test complete."

Setting Default Lager Box

To avoid specifying --box on every command, set a default Lager Box:
# Set default Lager Box
lager defaults add --box my-lager-box

# Now commands use the default
lager supply supply1 voltage 3.3
lager adc adc1

Global Options

All commands support these global options:
OptionDescription
--box TEXTLager Box name or IP address
--helpShow help for any command
--versionShow CLI version

Tips

  • Use lager <command> --help to see all options for any command
  • Most commands support --yes to skip confirmation prompts
  • Set defaults with lager defaults add to reduce typing
  • Use the tui subcommand (where available) for interactive control
  • Commands that read values (like adc, soc) can be used in scripts