CEC (Consumer Electronics Control) over HDMI
The Raspberry Pi (Broadcom BCM2835 SoC) hardware has integrated support for CEC (Consumer Electronics Control) over the HDMI port.
CEC (Consumer Electronics Control) is the control protocol found in HDMI. If you have not heard of CEC, you may have heard of it in another form from television manufacturers; Sony call it Bravialink, LG call it Simplink, Sharp call it Aquos Link, Pioneer call it Kuro Link, Philips call it EasyLink, and Samsung call it Anynet+, and so on.
Having Raspberry Pi's hardware support in libCEC would mean that you could control XBMC and MythTV front-end GUI via your television remote control without having a dedicated HTPC / MCE remote for your Raspberry Pi.
Once connected your Raspberry Pi to your TV and receiver with HDMI you could enjoy seamless connectivity, XBMC will automatically turn on and off your TV, receivers, and other home theater equipment. Volume control from XBMC can be sent to your amplifier, manage your DVD or Blu-Ray player from inside XBMC, and redirect the active source on your TV to whichever equipment needs it, all from one remote control. No line of sight is required and cables can be hidden neatly out of sight!
- 1 What is HDMI CEC?
- 2 Where to begin developing CEC support for Raspberry Pi?
- 3 libCEC
- 4 Alternative open source libraries and code for CEC
- 5 External links with more information for developers
What is HDMI CEC?
Consumer Electronics Control (CEC) is an HDMI feature designed to allow the user to command and control up-to ten CEC-enabled devices, that are connected through HDMI, by using only one of their remote controls (for example by controlling a television set, set-top box, PVR/DVR, and DVD player using only the remote control of the TV). CEC also allows for individual CEC-enabled devices to command and control each other without user intervention.
It is a one-wire bidirectional serial bus that uses the industry-standard AV.link protocol to perform remote control functions. CEC wiring is mandatory, although implementation of CEC in a product is optional. It was defined in HDMI Specification 1.0 and updated in HDMI 1.2, HDMI 1.2a and HDMI 1.3a (which added timer and audio commands to the bus). USB to CEC Adapters exist that allow a computer to control CEC enabled devices.
Trade names for CEC are Anynet+ (Samsung); Aquos Link (Sharp); BRAVIA Link and BRAVIA Sync (Sony); HDMI-CEC (Hitachi); E-link (AOC); Kuro Link (Pioneer); CE-Link and Regza Link (Toshiba); RIHD (Remote Interactive over HDMI) (Onkyo); RuncoLink (Runco International); SimpLink (LG); HDAVI Control, EZ-Sync, VIERA Link (Panasonic); EasyLink (Philips); and NetCommand for HDMI (Mitsubishi).
Some of the available HDMI-CEC commands
- One Touch Play: the device will become active source when playback starts
- System Standby: switches all connected devices to standby
- Preset Transfer: transfers the tuner channel setup to another TV set
- One Touch Record: start recording immediately
- Timer Programming: allow one device (e.g. a TV set or HTPC) to set the timer programming of another (e.g. a PVR,/DVR or DVD-recorder)
- System Information: checks all components for bus addresses and configuration
- Deck Control: playback control
- Tuner Control: control the tuner of another device
- OSD Display: use the OSD of the TV set to display text
- Device Menu Control: use the menus of another device
- Routing Control: control the switching of signal sources
- Remote Control Pass Through: pass through remote control commands
- Device OSD Name Transfer: transfer the preferred device names to the TV set
CEC stands for Consumer Electronics Control. It is implemented as a single wire bus in the HDMI connector (pin 13). It allows various HDMI-enabled products to connect and communicate with each other. It allows various HDMI-enabled products to connect and communicate with each other. The intent is to enable one remote control to interface with all the A/V components. Various message opcodes can be exchanged between the connected systems in order to do device specific actions (like recording on a STB/DVR) or get general information across (like transferring remote control key press details).
In any HDMI setup, the display is considered to be the root, and gets allocated two special tags, a physical address of 0.0.0.0 and a logical address of 0. In any given system, all CEC enabled devices have both physical and logical addresses, while the non-CEC devices have only physical addresses. Physical addresses are taken up based on the position of the device with respect to the root. For example, if an A/V receiver's output is connected to HDMI1 of the TV, it gets the physical address 188.8.131.52. A device connected to the first HDMI input port of the A/V receiver would get the address 184.108.40.206, while one connected to the second HDMI port would get 220.127.116.11. Logical addresses are taken on by the devices depending on their functionality (as mandated by the CEC specifications document). When the HDMI device menu is brought up on the display (On a Sony KDL46EX720, this is achieved by pressing the Sync Menu button), the display sends a broadcast over the CEC wire to all the downstream devices. It then collects the responses arriving over the CEC wire and presents the user with a list of CEC enabled devices. Choosing one of them ensures that future remote key presses are transferred by the TV to that particular address.
If you are interested in learning about the bus protocol and a bit more in-depth overview, I suggest taking a look at QuantumData's excellent CEC whitepaper (PDF). For more details on the various messages which can be exchanged between the devices, the full CEC specifications from the official HDMI documentation may be perused (PDF).
CEC with XBMC Media Center software
CEC allows XBMC to turn your TV, receivers, and other attached equipment on and off (if they support HDMI CEC) adjust the volume or eject the disk from a drive. Start playback, etc. and much more.
Likewise these same devices can tell XBMC what to do, for example, your TV remote can also control XBMC, or vice versa. With this device you can move that step closer to a clutter free living space while maintaining simple remote control for friends and family who may not be familiar with all of the features of a professional remote control.
See CEC in action and read about what it can do with XBMC:
Where to begin developing CEC support for Raspberry Pi?
Best would be for someone to add support for the Raspberry Pi's CEC hardware to the libCEC library by Pulse-Eight available on GitHub.com
libCEC is an open-source dual licensed library originally designed for communicating with the Pulse-Eight USB - HDMI CEC Adaptor.
libCEC needs the following dependencies in order to work correctly:
- udev v151 or later
- cdc-acm support compiled into the kernel or available as module
- Windows, Mac OS X, and Linux support
- Turns on/off TV and receivers (e.g. when the screensaver becomes active, to save power)
- Switch the TV and receivers to the correct HDMI port when starting your media center software
- Send and receive key presses from your TV's remote
- Control the volume of a CEC capable A/V receiver from your media center software
- Sniff active traffic on CEC bus
- Interfaces for C, C++ and .NET/CLR
- No binary-only or obfuscated code; everything is open and can be modified
- Example implementations in C++ and C#
- And much more...
libCEC supported software
- XBMC v11.0 "Eden" or higher
- MythTV v0.25 or higher
Alternative open source libraries and code for CEC
Alternative, a cross-platform CEC library designed for Realtek SoC, a GPL v3 libraries exists for Arduino board (tmega series chip) and the TI msp430 chip the TI MSP430 chip, that could probably also be modified to work on the Broadcom BCM2835 SoC in the Raspberry Pi.
Realtek 1283 SoC ('MARS') platforms with CEC, a cross CEC library and a CEC daemon/service
cec-arduino - Arduino library for communicating with HDMI CEC equipment
TI msp430 linux changes and CEC library repository
- CEC-O-Matic website, helps developers in decoding and creating CEC frames for communication - For the general user, the cec-o-matic.com website also gives an idea as to what can be achieved in a home automation system using CEC with HDMI equipment
- Quantum Data white paper - Designing CEC into your next HDMI Product (PDF)
- HDMI.org - Designing CEC into your next HDMI Product (PDF)
- The Promise of HDMI-CEC (PDF)
- HDMI-CEC Specifications v1.3a
- RainShadow Tech LLC - HDMI-CEC to USB Bridge and HDMI-CEC to RS-232 Bridge (PDF)
- Kwikwai's HDMI CEC-Ethernet-USB-Serial bridge