Installing LIBCEC on Wheezy (tested on a Samsung TV)


16 posts
by OoM_JaN » Sat Mar 01, 2014 3:21 pm
Step by step installation of the LIBCEC module on a Wheezy Rapberry.



Start in the home directory
Code: Select all
cd /home


Install the necessary tools for compiling:
Code: Select all
sudo apt-get install build-essential autoconf liblockdev1-dev libudev-dev git libtool pkg-config


Clone the git repository:
Code: Select all
sudo git clone git://github.com/Pulse-Eight/libcec.git


Compile:
Code: Select all
cd libcec

Code: Select all
sudo ./bootstrap

Code: Select all
sudo ./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi

Code: Select all
sudo make

Code: Select all
sudo make install


Link the libraries so that cec-client can find them:
Code: Select all
sudo ldconfig


Check that cec-client have found the device by running:
Code: Select all
cec-client -l


Found devices: 1

device: 1
com port: RPI
vendor id: 2708
product id: 1001
firmware version: 1
type: Raspberry Pi

To send commands to for instance a connected TV:

Turn off TV:
echo “standby 0” | cec-client -s
Posts: 1
Joined: Sat Mar 01, 2014 3:07 pm
by tomtomclub » Thu May 08, 2014 3:27 pm
how to do in OpenELEC xbmc
Posts: 29
Joined: Wed Apr 03, 2013 7:23 pm
by Xumpy » Sat Jun 14, 2014 10:33 am
I just want to add that you need all your libraries set in /opt/vc

Check if there is an include and lib folder in /opt/vc. If there isn't one download the raspberry firmware master repos: https://github.com/raspberrypi/firmware

Copy the opt/vc folder from this repos to your own /opt/vc folder and the configure will work flawless. If you don't do this then you will get the error: configure: error: Raspberry Pi API not found or incompatible with libCEC

Regards

Xump
Posts: 14
Joined: Tue Jun 04, 2013 9:23 pm
by hanzelpeter » Mon Jun 16, 2014 8:10 am
Hello.

Will this library work with Samsung LCD monitor with HDMI input. Or CEC is just for TVs?
User avatar
Posts: 66
Joined: Mon Jul 09, 2012 11:56 am
by danielblarg » Fri Nov 28, 2014 6:07 am
Thanks for this, I've got it working well with my Panasonic TV.
It wasn't working until I switched to a different HDMI cable.

Now I'm using python-cec (https://github.com/trainman419/python-cec) to make a script to control the Pi with the TV remote.
Posts: 1
Joined: Thu Nov 27, 2014 8:53 am
by L1ttl3J1m » Mon Dec 29, 2014 6:15 am
Beautiful - works almost perfectly out of the box, thank you very much!

Just a couple of points:

For the git clone command, if you leave off the "sudo" from the beginning, it creates the directory under your own user account, thus obviating the need for the "sudo" command through the rest of the steps up to
Code: Select all
sudo make install


This is also the preferred method because it means you don't end up with files belonging to root (which you can't edit or delete) in the user home directory.


Secondly, there is a development in automake (specifically, libtoolize) that is going to break the process as described here because the macros that
Code: Select all
./bootstrap
uses to create the files that
Code: Select all
./configure
works on need to be in their own directory at the top of the source tree.

What that means (in non-geek speak) is that after
Code: Select all
sudo git clone git://github.com/Pulse-Eight/libcec.git

cd libcec


you need to create the m4 directory;

Code: Select all
mkdir m4


and then edit configure.ac;

Code: Select all
 nano
(or your editor of choice)
Code: Select all
 configure.ac


After the line
Code: Select all
CFLAGS="$cflags_reset"

add
Code: Select all
AC_CONFIG_MACRO_DIR([m4])


and in Makefile.am (nano again, or your equivalent to edit it), add

Code: Select all
ACLOCAL_AMFLAGS = -I m4



then continue with
Code: Select all
 ./bootstrap


If you're seeing the errors

Code: Select all

 libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.



this is how you fix that!
Posts: 1
Joined: Mon Dec 29, 2014 5:53 am
by drgeoff » Mon Dec 29, 2014 8:42 pm
hanzelpeter wrote:Hello.

Will this library work with Samsung LCD monitor with HDMI input. Or CEC is just for TVs?

Probably will not work because of no CEC on monitor. Consult the specs of the monitor. If the monitor does not have a remote control (of the TV type) with 'transport' buttons (play, stop, rewind etc) then the chances are slim.
Posts: 5969
Joined: Wed Jan 25, 2012 6:39 pm
by sebi » Sat Apr 04, 2015 3:28 pm
Hi,

Sorry for this post in this old thread.

But they have changed the compile method of LibCEC.

So you can't run the shell script by the command ./bootstrap.

Do anybody know which Release will work.

Sebi
Posts: 11
Joined: Thu May 01, 2014 10:55 am
by sebi » Sun Apr 05, 2015 5:44 pm
Hi

I have tested it with the Release 2.2.0, but i have to use this configure command

Code: Select all
sudo ./configure --with-rpi-include-path="/opt/vc/include" --with-rpi-lib-path="/opt/vc/lib/" --enable-rpi

https://drgeoffathome.wordpress.com/201 ... pberry-pi/

Can anybody tell me, what I have to do, to compile it with cmake?
Posts: 11
Joined: Thu May 01, 2014 10:55 am
by magro » Mon Apr 13, 2015 6:31 pm
Did somebody have success with libCEC version 3 ?
Posts: 2
Joined: Mon Apr 13, 2015 6:27 pm
by nlrb » Tue Apr 14, 2015 7:11 pm
Yes, I've the listed the steps in this post.
Posts: 6
Joined: Mon Apr 13, 2015 7:50 pm
by magro » Thu Apr 16, 2015 2:46 pm
TKS nlrb. It works fine.
Posts: 2
Joined: Mon Apr 13, 2015 6:27 pm
by spiru » Sun Sep 06, 2015 3:35 pm
Can someone please tell me why I am getting ./bootstrap: command not found after I try sudo ./bootstrap. I'm a newbie in linux guys.
I would appreciate help cause this is killing me
Posts: 5
Joined: Sun Sep 06, 2015 3:31 pm
by DougieLawson » Sun Sep 06, 2015 11:25 pm
Because dot slash (./) in front of a file name means look in the current working directory and your "bootstrap" script isn't in there.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 23088
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by spiru » Mon Sep 07, 2015 12:49 pm
Thanks for the reply. So Do I have to get the libcec bootstrap file from somewhere? or bootstrap is an OS command file, is it installed in a default directory?
Posts: 5
Joined: Sun Sep 06, 2015 3:31 pm
by dragos » Fri Jun 24, 2016 9:25 am
Hi, has anybody solved this ./bootstrap problem? I also get command not found! How do I solve it? Thought this is a good tutorial but full of wrong info!
Posts: 15
Joined: Tue Sep 08, 2015 4:50 pm