LinuxCommandLibrary

cec-ctl

Control HDMI CEC devices

TLDR

List CEC devices

$ cec-ctl --list-devices
copy

Monitor CEC traffic
$ sudo cec-ctl [[-m|--monitor]]
copy

Show CEC topology
$ cec-ctl [[-S|--show-topology]]
copy

SYNOPSIS

cec-ctl [options] <command> [<command-options>] [<command-args>]

PARAMETERS

-d, --device=<DEV>
    Use specific CEC device, e.g. /dev/cec0

-a, --adapter-name=<NAME>
    Select by adapter name (cec device name)

-l, --list-devices
    List all available CEC adapters

-V, --version
    Display version information

-h, --help
    Show full help text

-v, --verbose[=<LEVEL>]
    Increase verbosity (repeatable, 0-4)

-q, --quiet
    Suppress all log output

DESCRIPTION

cec-ctl is a powerful command-line utility for controlling and testing CEC (Consumer Electronics Control) over HDMI in Linux. CEC enables interconnected HDMI devices—like TVs, players, and receivers—to communicate for features such as power on/off, volume control, and input switching.

It supports listing CEC adapters, querying capabilities, monitoring messages, transmitting raw or opcode-based commands, setting physical addresses, and handling hotplug detection. Ideal for developers debugging hardware, automating AV setups, or verifying compliance.

Part of the v4l-utils package, it interfaces with the kernel's CEC framework via /dev/cec* nodes. Verbose logging aids troubleshooting, with levels from errors to debug traces. Supports multiple adapters and low-level message crafting using hex opcodes and operands.

Example workflows: enumerate devices, enable features, transmit standby (opcode 0x36), or monitor traffic in real-time. Works on platforms like Raspberry Pi, NVIDIA Shield, and Intel/AMD PCs with CEC hardware.

CAVEATS

Requires read/write access to /dev/cec* (often needs sudo). Hardware-dependent; not all adapters support full CEC features. Transmissions may fail if logical address conflicts.

KEY SUBCOMMANDS

list: Enumerate adapters
features: Dump capabilities
monitor-all/-pin: Sniff traffic
transmit: Send message (e.g. transmit 04 for image-view-on)

EXAMPLE USAGE

cec-ctl --list-devices
cec-ctl -d /dev/cec0 features
cec-ctl -d /dev/cec0 transmit 36 (standby)

HISTORY

Introduced in v4l-utils 1.14.0 (2019), enhancing Linux kernel CEC support added in 3.5 (2012). Evolved with kernel features like multi-phys support and HPD integration.

SEE ALSO

v4l2-ctl(1), cec-compliance(1)

Copied to clipboard