CEC-CTL(1)

πŸ“¦
version 1.32.0 Β· 5 versions
, in alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

✨ CEC-CTL ✨

okay bestie, gather round, because this is the manual page for cec-ctl β€” that's the CEC-CTL(1) girlies, User Commands section, and she is long but she is iconic πŸ’…


πŸŽ€ NAME πŸŽ€

cec-ctl β€” an application to control cec devices. that's it. that's the job. she controls cec devices πŸ’–


🌸 SYNOPSIS 🌸

cec-ctl [-h] [-d <dev>] [many other options]

yes, "many other options" is literally what the page says, and honestly? she's not wrong, we're about to get into all of them 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so the tea is: the cec-ctl tool controls cec devices. and when we say controls, we mean she can mess with almost any aspect of them β€” like, she covers the full CEC API. full. entire. no crumbs. 😀

the easiest way to quickly test a CEC adapter of an HDMI output is:

cec-ctl -d/dev/cecX --playback -S

this is what you'd use if the HDMI output of your device supports CEC β€” because your device plays back video, so it's a CEC Playback device. makes sense, right? the device plays stuff back. playback. slay.

and for an HDMI input:

cec-ctl -d/dev/cecX --tv -S

this one's for when your device has an HDMI input, i.e. it acts like a TV. main character TV energy πŸ‘‘

both commands configure the CEC adapter and show the CEC topology. important note bestie, don't skip this part: the --playback and --tv options configure your device β€” they are not about what device you will be talking to. it's giving "know thyself" πŸͺž

to put a display to standby use:

cec-ctl -d/dev/cecX --to 0 --standby

to wake up the display:

cec-ctl -d/dev/cecX --to 0 --image-view-on

to switch the TV to our HDMI output (and yeah, replace the physical address with what cec-ctl -d/dev/cecX reported):

cec-ctl -d/dev/cecX --to 0 --active-source phys-addr=1.0.0.0

and here's a lil shortcut for you πŸ’… instead of -d/dev/cecX you can also write this as -dX. and instead of --to 0 you can also write this as -t0. shorter, cuter, same energy.


🌈 OPTIONS 🌈

strap in. she's thorough. (as she should be.)

  • -A, --list-devices β€” list all cec devices. window shopping, but for adapters πŸ›οΈ
  • -d, --device <dev> β€” use device <dev> as the CEC device. if <dev> is a number, then /dev/cec<dev> is used. so like, -d0 secretly means /dev/cec0. sneaky. love that.
  • -D, --driver <drv> β€” use a cec device that has driver name <drv>, as returned by the CEC_ADAP_G_CAPS ioctl. this option can be combined with -a to uniquely identify a CEC device without having to rely on the device node number. no node numbers needed, we're classy πŸ’–
  • -a, --adapter <adap-name> β€” use a cec device that has adapter name <adap-name>, as returned by the CEC_ADAP_G_CAPS ioctl. this option can be combined with -D to uniquely identify a CEC device without having to rely on the device node number. yeah, it's the partner-in-crime to -D. power couple 🫢
  • -v, --verbose β€” turn on verbose reporting. she will talk. πŸ’¬
  • --version β€” show version information.
  • -w, --wall-clock β€” show timestamps as wall-clock time. this also turns on verbose reporting. two for one, we love a bundle ✨
  • -h, --help β€” prints the help message. when in doubt, -h it out πŸ™ˆ
  • -p, --phys-addr <addr> β€” use this physical address. the address can be a number (e.g. 0 or 0x11b1) or formatted as a.b.c.d where each component is a hex value from 0-f (e.g. 0.0.0.0 or 1.1.b.1). two formats, one icon πŸ’…
  • -e, --phys-addr-from-edid <path> β€” parse the given EDID file (in raw binary format) and extract the physical address. if the EDID file does not exist or does not contain a physical address, then invalidate the physical address. no edid, no address, periodt.
  • -E, --phys-addr-from-edid-poll <path> β€” parse the given EDID file (in raw binary format) and extract the physical address. if the EDID file does not exist or does not contain a physical address, then invalidate the physical address. poll for changes in this EDID file every 100 ms and, if changed, update the physical address.

this provides a way for Pulse-Eight (or similar) USB CEC dongles to become aware of HDMI disconnect and reconnect events. πŸ‘€

polling happens in the background while cec-ctl processes other requested actions (i.e. transmitting messages, waiting for replies, etc.) and when that is all done cec-ctl will keep polling until the user kills cec-ctl (Ctrl-C). so she's nosy and she does not stop. multitasking queen πŸ‘‘

  • -o, --osd-name <name> β€” use this OSD name. the maximum length is 14 characters. fourteen. not fifteen. don't test her.
  • -V, --vendor-id <id> β€” use this vendor ID. the vendor ID is a number from 0x0 to 0xffffff.
  • -x, --physical-address β€” show the physical address. if invalid, the physical address will be reported as f.f.f.f. useful for scripts, e.g.: la=cec-ctl -s -x``
  • -l, --logical-address β€” show first configured logical address or nothing if the device is unconfigured. useful for scripts, e.g.: la=cec-ctl -s -l``
  • -L, --logical-addresses β€” show all configured logical addresses or nothing if the device is unconfigured. useful for scripts, e.g.: las=cec-ctl -s -L``
  • -C, --clear β€” clear all logical addresses, leaving the CEC device unconfigured. clean slate bestie 🧼
  • -n, --no-reply β€” by default when sending a CEC message that expects a reply this utility will wait for that reply. with this option it will just send it without waiting for the reply. this option applies to the messages following this option. it acts as a toggle, so after you specify it a second time then the following messages will wait for a reply again. flip flop flip flop πŸ¦‹
  • -N, --non-blocking β€” transmit messages in non-blocking mode.
  • -t, --to <la> β€” send the message to the given logical address (0-15).
  • -f, --from <la> β€” send message from the given logical address. it is only necessary to use this option if multiple logical addresses are claimed. by default the first assigned logical address will be used.
  • -r, --show-raw β€” show the raw CEC message in hex. the raw tea β˜•
  • -s, --skip-info β€” skip the Driver Info output section. we're skipping the intros, getting straight to the plot πŸ“–
  • -S, --show-topology β€” show the CEC topology, detecting which other CEC devices are on the CEC bus. who's on the bus? let's find out πŸ”
  • -P, --poll β€” send a poll message.
  • -T, --trace β€” trace all called ioctls. useful for debugging. she's showing her work ✍️
  • --cec-version-1.4 β€” use CEC Version 1.4 instead of 2.0 (the default). throwback era πŸ’œ
  • --allow-unreg-fallback β€” allow fallback to Unregistered if all logical addresses are claimed. by default the adapter will remain unconfigured.
  • --no-rc-passthrough β€” disable the RC passthrough. by default remote control CEC messages are passed on as input keystrokes (the CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU flag is set when calling the CEC_ADAP_S_LOG_ADDRS ioctl), but this can be blocked by using this option.
  • --reply-to-followers β€” the reply will be sent to followers as well. by default the reply will only go to the follower that initiated the CEC message. but if you have other followers running as well, then by giving this option they will also receive the reply. group chat, not a DM πŸ’¬
  • --timeout <ms> β€” set the reply timeout in milliseconds (default is 1000 ms). one whole second of patience. generous fr fr.
  • --tv β€” configure the CEC adapter as a TV.
  • --record β€” configure the CEC adapter as a recording and playback device.
  • --tuner β€” configure the CEC adapter as a tuner device.
  • --playback β€” configure the CEC adapter as a playback device.
  • --audio β€” configure the CEC adapter as an audio system device.
  • --processor β€” configure the CEC adapter as a processor device.
  • --switch β€” configure the CEC adapter as a pure CEC switch.
  • --cdc-only β€” configure the CEC adapter as a CDC-only device.
  • --unregistered β€” configure the CEC adapter as an unregistered device.
  • --feat-record-tv-screen β€” signal the Record TV Screen feature.
  • --feat-set-osd-string β€” signal the Set OSD String feature.
  • --feat-deck-control β€” signal the Deck Control feature.
  • --feat-set-audio-rate β€” signal the Set Audio Rate feature.
  • --feat-sink-has-arc-tx β€” signal the sink ARC Tx feature.
  • --feat-source-has-arc-rx β€” signal the source ARC Rx feature.
  • --rc-tv-profile-1 β€” signal RC TV Profile 1.
  • --rc-tv-profile-2 β€” signal RC TV Profile 2.
  • --rc-tv-profile-3 β€” signal RC TV Profile 3.
  • --rc-tv-profile-4 β€” signal RC TV Profile 4.
  • --rc-src-dev-root β€” signal that the RC source has a Dev Root Menu.
  • --rc-src-dev-setup β€” signal that the RC source has a Dev Setup Menu.
  • --rc-src-contents β€” signal that the RC source has a Contents Menu.
  • --rc-src-media-top β€” signal that the RC source has a Media Top Menu.
  • --rc-src-media-context β€” signal that the RC source has a Media Context Menu.
  • -m, --monitor β€” start monitoring CEC traffic. this will monitor broadcast messages, messages directed to this CEC adapter and messages transmitted by this CEC adapter. directed messages between other CEC devices are not monitored. this option requires root. so she sees some things, not everything. boundaries! 🚧
  • -M, --monitor-all β€” start monitoring all CEC traffic. this will monitor all CEC messages, including directed messages between other CEC devices. this option requires root. not all CEC devices support this monitoring mode. it will fallback to regular monitoring mode if it is not supported. now that's the full surveillance era πŸ‘οΈ
  • --monitor-pin β€” start monitoring and analyzing the low-level CEC pin transitions. this is only possible if the device has the CEC_CAP_MONITOR_PIN capability. this option requires root. when in pin monitoring mode all 0->1 and 1->0 CEC pin transitions are monitored and analysed. this is effectively a cheap CEC bus analyzer. cheap and effective, we love a budget icon πŸ’…
  • --monitor-time <secs> β€” monitor for the given number of seconds, then exit. the default (0) is to monitor forever. forever is a long time bestie 😭
  • --ignore <la>,<opcode> β€” ignore messages from logical address <la> and opcode <opcode> when monitoring. "all" can be used for <la> or <opcode> to match all logical addresses or opcodes. to ignore poll messages use "poll" as <opcode>. mute button, but make it precise πŸ”‡
  • --store-pin <to> β€” store the CEC pin events to the given file. this can be read and analyzed later via the --analyze-pin option. use - to write to stdout instead of to a file. save it for later, scrapbook style πŸ“Έ
  • --analyze-pin <from> β€” read and analyze the CEC pin events from the given file. use - to read from stdin instead of from a file. then the forensic era begins πŸ”¬
  • --test-reliability <secs> β€” this option tests the CEC reliability by transmitting <Give Physical Addr> up to <secs> seconds (or forever if <secs> is 0) and check if the reply is always the same. since the reply is a broadcast message, it is in practice never Nacked and so any bit errors due to poor CEC signal quality will clearly show up. the message will be sent to the logical address specified by --to. stress test but make it CEC πŸ”₯
  • --test-standby-wakeup-cycle [polls=<n>][,sleep=<secs>][,hpd-may-be-low=<0/1>] β€” this option tests the standby-wakeup cycle behavior of the display. it polls up to <n> times (default 15), waiting for a state change. if that fails then it waits <secs> seconds (default 10) before retrying this. if <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby. nap time, wake up, repeat πŸ’€

part 1 done bestie, more is coming β€” don't go anywhere πŸ’–
  • --stress-test-standby-wakeup-cycle cnt=<count>[,polls=<n>][,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,repeats=<reps>][,sleep-before-on=<secs1>][,sleep-before-off=<secs2>][,hpd-may-be-low=<0/1>] β€” okay so this is the big girl stress test πŸ’… it puts a display through its paces by cycling it in and out of standby <count> times, using the CEC Standby and Image View On commands. And if <count> is 0? bestie it literally never stops 😭

Here's the full tea, no skipping:

  • It polls up to <n> times (default 30), just sitting there waiting for a state change like πŸ‘€
  • If <maxsecs> is non-zero (0 is the default, so it's off unless you say otherwise), it sleeps for a random number of seconds between <minsecs> (0 is the default) and <maxsecs> before each Standby or Image View On message. Random naps, iconic ✨
  • If <seed> is specified, it sets the randomizer seed to that value instead of using the current time as the seed. Reproducible chaos, we love her πŸŽ€
  • If <reps> is specified, it repeats the Image View On and Standby up to <reps> times.
⚠️ Not me having to say this: this test should work without any repeats. If a non-zero <reps> value is needed in order to pass this test, then that indicates a problem. Like, a real one. fr fr 🚩
  • If <secs1> is specified, it sleeps for <secs1> seconds before transmitting Image View On.
  • If <secs2> is specified, it sleeps for <secs2> seconds before transmitting Standby.
  • If <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby. Permission granted, slay 🫢
  • --stress-test-random-standby-wakeup-cycle cnt=<count>[,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,hpd-may-be-low=<0/1>] β€” the chaos goblin sibling of the test above πŸ”₯ same energy (stress test for a display, cycles it in and out of standby <count> times using the CEC Standby and Image View On commands), but the vibe is different:
    • After each command it waits between <minsecs> (default is 0) and <maxsecs> (default is 10) seconds.
    • It does not check whether the display reached the new state. That's literally the point β€” this test is meant to check whether the display can handle state change commands while it's still transitioning to a new state. Poking the bear mid-transition, highkey rude but that's the assignment πŸ’€
    • After every 10 cycles it attempts to properly wake up the display and check if that works. If not, this test fails. Periodt.
    • If <count> is 0, then it never stops. Ever. πŸŒ€
    • If <seed> is specified, then set the randomizer seed to that value instead of using the current time as seed.
    • If <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby.
  • --help-all β€” prints the help message for all the options. Everything, all at once, main character energy πŸ‘‘
  • --help-audio-rate-control β€” shows help for the Audio Rate Control feature.
  • --help-audio-return-channel-control β€” shows help for the Audio Return Channel Control feature.
  • --help-capability-discovery-and-control β€” shows help for the Capability Discovery and Control feature.
  • --help-deck-control β€” shows help for the Deck Control feature.
  • --help-device-menu-control β€” shows help for the Device Menu Control feature.
  • --help-device-osd-transfer β€” shows help for the Device OSD Transfer feature.
  • --help-dynamic-audio-lipsync β€” shows help for the Dynamic Audio Lipsync feature.
  • --help-htng β€” shows help for the Hospitality Profile Next Generation feature. Heads up bestie: this is an optional CEC extension for Hotel displays and it's not generally available for regular displays πŸ™ˆ More info lives at http://www.htng.org if you're curious.
  • --help-osd-display β€” shows help for the OSD Display feature.
  • --help-one-touch-play β€” shows help for the One Touch Play feature.
  • --help-one-touch-record β€” shows help for the One Touch Record feature.
  • --help-power-status β€” shows help for the Power Status feature.
  • --help-remote-control-passthrough β€” shows help for the Remote Control Passthrough feature.
  • --help-routing-control β€” shows help for the Routing Control feature.
  • --help-standby β€” shows help for the Standby feature.
  • --help-system-audio-control β€” shows help for the System Audio Control feature.
  • --help-system-information β€” shows help for the System Information feature.
  • --help-timer-programming β€” shows help for the Timer Programming feature.
  • --help-tuner-control β€” shows help for the Tuner Control feature.
  • --help-vendor-specific-commands β€” shows help for the Vendor Specific Commands feature.

🌈 EXIT STATUS 🌈

Okay so when everything goes right, it returns 0 β€” the sweetest little green flag ever πŸ’š

Otherwise, it will return the error code. So if you see a number that is not zero, that's your sign, go read it 😀


πŸ¦‹ BUGS πŸ¦‹

Real talk: this manual page is a work in progress. She's growing, she's evolving, she's not done yet 🌱

Bug reports or questions about this utility should be sent to the linux-media@vger.kernel.org mailinglist. Yes, the mailing list, that's where the homies hang out πŸ“¬


And that's a wrap on CEC-CTL(1), bestie. πŸ’– This whole page is riding with v4l-utils 1.32.0, dated August 2016 β€” a certified classic that still eats πŸ’…βœ¨ go forth and control your CEC devices responsibly, mwah πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from