CEC-CTL(1)
β¨ 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,-d0secretly means/dev/cec0. sneaky. love that.-D,--driver<drv> β use a cec device that has driver name <drv>, as returned by theCEC_ADAP_G_CAPSioctl. this option can be combined with-ato 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 theCEC_ADAP_G_CAPSioctl. this option can be combined with-Dto 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,-hit out π-p,--phys-addr<addr> β use this physical address. the address can be a number (e.g.0or0x11b1) or formatted asa.b.c.dwhere each component is a hex value from0-f(e.g.0.0.0.0or1.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 from0x0to0xffffff.-x,--physical-addressβ show the physical address. if invalid, the physical address will be reported asf.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 (theCEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRUflag is set when calling theCEC_ADAP_S_LOG_ADDRSioctl), 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 theCEC_CAP_MONITOR_PINcapability. this option requires root. when in pin monitoring mode all0->1and1->0CEC 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-pinoption. 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> is0? 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 athttp://www.htng.orgif 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
- alpine 3.24: v4l-utils-doc 1.32.0-r1 Β· LGPL-2.0-or-later
- arch rolling: v4l-utils 1.32.0-2 Β· LGPL
- fedora 43: v4l-utils 1.32.0-1.fc43 Β· GPL-2.0-or-later AND GPL-2.0-only AND (GPL-2.0-only OR BSD-3-Clause) AND LicenseRef-Fedora-Public-Domain AND HPND-sell-variant
- fedora 44: v4l-utils 1.32.0-3.fc44 Β· GPL-2.0-or-later AND GPL-2.0-only AND (GPL-2.0-only OR BSD-3-Clause) AND LicenseRef-Fedora-Public-Domain AND HPND-sell-variant
- nixos 26.05: v4l-utils 1.32.0
- nixpkgs unstable: v4l-utils 1.32.0
- ubuntu resolute: v4l-utils 1.32.0-2ubuntu1
- ubuntu stonking: v4l-utils 1.32.0-5ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms