CEC allows the user to run all sorts of commands:
- One Touch Play allows devices to switch the TV to use it as the active source when playback starts
- System Standby enables users to switch multiple devices to standby mode with the press of one button
- Preset Transfer transfers the tuner channel setup to another TV set
- One Touch Record allows users to record whatever is currently being shown on the HDTV screen on a selected recording device
- Timer Programming allows users to use the electronic program guides (EPGs) that are built into many HDTVs and set-top-boxes to program the timer in recording devices like PVRs and DVRs
- System Information checks all components for bus addresses and configuration
- Deck Control allows a component to interrogate and control the operation (play, pause, rewind etc.), of a playback component (Blu-ray or HD DVD player or a Camcorder, etc.)
- Tuner Control allows a component to control the tuner of another component
- OSD Display uses the OSD of the TV set to display text
- Device Menu Control allows a component to control the menu system of another component by passing through the user interface (UI) commands
- Routing Control controls the switching of signal sources
- Remote Control Pass Through allows remote control commands to be passed through to other devices within the system
- Device OSD Name Transfer transfers the preferred device names to the TV set
- System Audio Control allows the volume of an AV receiver, integrated amplifier or preamplifier to be controlled using any remote control from a suitably equipped device(s) in the system
The Raspberry Pi is one of few computing devices that has HDMI CEC support. In order to take advantage of this wonderful feature on the Raspberry Pi you can use the Raspbmc home media center. Raspbmc is XMBC (Xbox Media Center) for Raspberry Pi. You can also use OpenELEC which is another XMBC distro for the Pi.
XBMC has CEC support which works fantastically for your home media center if the Pi is plugged into your TV. This allows you to control XBMC with commands like Play/Pause etc directly from your normal TV remote.
In order to configure your XBMC to allow CEC go to:
System > Settings > System > Input Devices > Peripherals > CEC adapter
and turn it on.
XBMC should then detect the television device and connect to it. On some televisions you may have to enable CEC in the settings or manually connect to XBMC.
You can find out more information, and whether your TV supports CEC, here:
http://wiki.xbmc.org/index.php?title=CEC
Or if you are interested in setting up CEC without using XBMC on Raspbian Wheezy, read on.
The CEC on XBMC relies on libCEC which is a library for CEC produced by Pulse Eight. It is pretty much the only CEC library out there. You can see it on Git Hub at https://github.com/Pulse-Eight/libcec
It supports many platforms including the Raspberry Pi.
Here are some instruction on installing it:
First of all install the necessary dependencies and packages
sudo apt-get install git-core autoconf automake libtool liblockdev1-dev
Change directory into the src directory
cd /usr/local/src
sudo git clone https://github.com/Pulse-Eight/libcec.git
Change directory into the the newly created libcec directory
cd libcec
To compile, execute the following:
sudo ./bootstrap
sudo ./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi
sudo make
sudo make install
You then need to link the libraries with the following commands:
sudo ln -s /usr/local/lib/libcec.so /usr/lib/
If all went according to plan then libCEC should now be installed. If it didn't then it might be because you are out of space on you SD card partition. If you are then try expanding the root partition of your SD card through the raspi-config interface and try again.
To test that the library is working enter cec-client -l into the command line and you should get something like this:
Found devices: 1
device: 1
com port: RPI
vendor id: 2708
product id: 1001
firmware version: 1
type: Raspberry Pi
This means that it has found the CEC ability on the Pi.
You can now test out the CEC (assuming you have it connected to a TV) and find out the television details:
echo "scan" | cec-client -d 1 -s "standby 0" RPI
This should print out lots of details.
Some useful commands are:
Get current power mode: echo "pow 0000" | cec-client -d 1 -s "standby 0" RPI
Tell the TV to enter standby mode: echo "standby 0000" | cec-client -d 1 -s "standby 0" RPI
Turn on the TV: echo "on 0000" | cec-client -d 1 -s "standby 0" RPI
Tell the TV to use the Raspberry Pi as active source: echo "as" | cec-client -d 1 -s "standby 0" RPI
In order to listen for TV remote button presses you can use the cec-client -l
This should then print out the button every time it is pressed.
I hope this was helpful.