Media center systems XBMC and MythTV already support HDMI-CEC via libCEC[1][2];
libCEC gained support for the Raspberry Pi in version 1.8.0[3], allowing you to control them via your television remote control without having a dedicated HTPC / MCE remote for your Raspberry Pi.

Once you have connected your Raspberry Pi to your TV and receiver with HDMI you should be able automatically to turn on and off your TV, receivers, and other home theater equipment, control your amplifier's volume, manage your DVD or Blu-Ray player, and redirect the active source on your TV to other equipment, all from one remote control. No line of sight is required and cables can be hidden neatly out of sight!

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 connected through HDMI by using just 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.

HDMI-CEC 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 (the last added timer and audio commands to the bus). USB to CEC Adapters exist that allow a computer to control CEC-enabled devices.

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

Technical concept

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 1.0.0.0. A device connected to the first HDMI input port of the A/V receiver would get the address 1.1.0.0, while one connected to the second HDMI port would get 1.2.0.0. 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.

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.

libCEC Features

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.