Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The command line (viva-camctl)

viva-camctl does from a terminal what a field engineer does with a vendor tool: find a camera, read it, change it, save and restore its configuration, reach a register the XML does not describe, and stream from it. It comes with the Python package (pip install viva-genicam), with every GitHub release, and from crates.io (cargo install viva-camctl).

viva-camctl <command> --help lists each command’s flags.

Choosing a camera

Commands that act on one camera take one of:

  • --ip <ADDRESS> — a GigE Vision camera by address;
  • --index <N> — the Nth GigE Vision camera list finds;
  • --usb <N> — the Nth USB3 Vision camera list-usb finds.

get, set, execute, features, describe, dump, save, load, read-reg, write-reg, stream, events, chunks, bench and report take --usb too. xml, action and set-ip are GigE Vision only.

Global options

These go before the command name:

  • -v / -vv — log at debug / trace (RUST_LOG overrides);
  • --json — machine-readable output, where the command has any;
  • --iface <IFACE> — the host interface, by one of its IPv4 addresses (192.168.0.5) or its OS name (eth0, or a GUID on Windows). list, xml, report, stream, events and bench also take it after the command name.

Commands

CommandWhat it does
listDiscover GigE Vision cameras; --ip asks one address directly
list-usbDiscover USB3 Vision cameras
featuresThe category tree: every feature with its type, access and value; --filter keeps the names that contain a word, --all shows invisible features too
describeOne feature in full: tooltip, description, unit, range and increment, enumeration entries, the selectors it has or is, and the nodes it depends on; a state it could not read is printed as such, and the command fails
dumpEvery value the camera has to read now, in XML order
get / setRead a feature, or write it from text
executeRun a command feature (UserSetLoad) and wait until the camera reports it done
save / loadSave the camera’s configuration to a file, and restore it (how)
read-reg / write-regRead device registers, or write one 32-bit register, past the XML
actionSend a GigE Vision action command and count the acknowledgements
streamStream frames and save some, or raw event-vision blocks; with --usb, from a USB3 Vision camera
benchSustained streaming benchmark, with an optional JSON report
eventsConfigure and read events: GigE Vision’s message channel, or a USB3 Vision camera’s event interface
chunksSwitch chunk mode and chunk selectors
set-ipGive a GigE Vision camera an address by MAC (FORCEIP with --force, persistent otherwise)
xmlThe camera’s GenApi XML, unparsed — so it works on a camera the library cannot open
reportA diagnostic bundle for a bug report (what to send)

A field engineer’s session

# What is this camera, and how is it set?
viva-camctl features --ip 192.168.0.10
viva-camctl features --ip 192.168.0.10 --filter exposure
viva-camctl describe --ip 192.168.0.10 --name ExposureTime
viva-camctl dump --ip 192.168.0.10 > before.txt

# Keep its configuration, change it, put it back.
viva-camctl save --ip 192.168.0.10 --out camera.txt
viva-camctl set  --ip 192.168.0.10 --name ExposureTime --value 5000
viva-camctl load --ip 192.168.0.10 --file camera.txt

# The same on a USB3 Vision camera.
viva-camctl save --usb 0 --out camera.txt

load prints each value it could not write, with the reason, and exits with an error if there was one; it warns when the file was saved from another camera model.

Registers

read-reg and write-reg reach the device without its XML, so they work on a camera whose XML we cannot read. Addresses and values are decimal or 0x-hexadecimal:

viva-camctl read-reg  --ip 192.168.0.10 --addr 0x0938            # GevHeartbeatTimeout
viva-camctl read-reg  --ip 192.168.0.10 --addr 0x0200 --len 512   # the first URL
viva-camctl write-reg --ip 192.168.0.10 --addr 0x0938 --value 3000
viva-camctl read-reg  --usb 0 --addr 0x0 --len 64

A 32-bit value is shown and written in the device’s byte order: big-endian on GigE Vision, little-endian on USB3 Vision. GigE Vision registers are whole 32-bit words at addresses that are multiples of 4; anything else is refused before it is sent. write-reg on GigE Vision takes control privilege for the write and gives it back.

Action commands

viva-camctl action --device-key 0x42 --group-key 1 --group-mask 0xffffffff
viva-camctl action --destination 192.168.0.10 --device-key 0x42 --group-key 1 \
    --group-mask 1 --scheduled-time 1700000000000000000

Every camera whose ActionDeviceKey, ActionGroupKey and ActionGroupMask match acts and acknowledges; action reports how many did, and names any camera that answered with an error instead — a camera without action commands may answer NOT_IMPLEMENTED whatever the keys, or say nothing. Broadcast is the default; --destination sends to one address, or to a subnet’s broadcast address. A scheduled action carries its time in the cameras’ timestamp ticks.

Streaming

viva-camctl stream --ip 192.168.0.10 --save 2                      # keep the camera's packet size
viva-camctl stream --ip 192.168.0.10 --auto --save 2               # size packets from the NIC MTU
viva-camctl stream --ip 192.168.0.10 --save 2 --save-format png    # 16-bit above 8 bits
viva-camctl bench  --ip 192.168.0.10 --duration-s 60 --json-out bench.json
viva-camctl bench  --usb 0 --duration-s 60
viva-camctl stream --usb 0 --save 3

list-usb shows each camera’s link speed, and opening a camera below SuperSpeed logs a warning: behind a USB 2 port, hub or cable a camera works, but only as fast as 480 Mbit/s carries. A USB3 Vision stream’s summary also counts USB transfers, transfers skipped, the transfer errors it recovered from, and frames the camera numbered but never delivered.

Packet size, receive port and resend are covered in the Networking Guide.