Hi,
I want to be able to turn my Samsung TV on (and off) and change to the correct HDMI input by a script or commandline using the HDMI CEC interface.
What is the easier way to do this?
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6930
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Turn on / off TV via HDMI CEC
I'd start with cec-client from libCEC.
There's some info here:
http://www.raspberrypi.org/phpBB3/viewt ... nt#p158409
There's some info here:
http://www.raspberrypi.org/phpBB3/viewt ... nt#p158409
Re: Turn on / off TV via HDMI CEC
Thanks, i'll give it a go.
Re: Turn on / off TV via HDMI CEC
I installed cec-client by 'apt-get install cec-client' however i only get a failure to detect all CEC adapters.
Do i need to compile cec-client or libcec specifically for raspi?
Do i need to compile cec-client or libcec specifically for raspi?
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6930
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Turn on / off TV via HDMI CEC
Yes.mavo wrote:I installed cec-client by 'apt-get install cec-client' however i only get a failure to detect all CEC adapters.
Do i need to compile cec-client or libcec specifically for raspi?
https://github.com/Pulse-Eight/libcec
Re: Turn on / off TV via HDMI CEC
I followed the instructions on how to compile libcec on raspberry itself.
However ./configure does not automatically find the raspi lib and headers, so i specified the path but ./configure ends with "raspberry pi api not found or incompatible with libcec".
Any idea on how to solve this?
I already updated to the latest raspi firmware using rpi-update.
However ./configure does not automatically find the raspi lib and headers, so i specified the path but ./configure ends with "raspberry pi api not found or incompatible with libcec".
Any idea on how to solve this?
I already updated to the latest raspi firmware using rpi-update.
Re: Turn on / off TV via HDMI CEC
I had this problem too; assuming you're running debian, you need to:
That will get you the latest VideoCore libraries that libCEC-1.8 requires.
Mine is compiling now so I haven't tested, but installing that package will make the configure stage work:
Code: Select all
apt-get install libraspberrypi-dev
Mine is compiling now so I haven't tested, but installing that package will make the configure stage work:
Code: Select all
Configured features:
Pulse-Eight CEC Adapter : yes
Pulse-Eight CEC Adapter detection : yes
Raspberry Pi support : yes
Re: Turn on / off TV via HDMI CEC
Hi,
Thanks for your feedback.
I'm running the wheezy image. The libraspberrypi-dev was already the latest version.
Any way to check specifically for the videocore lib?
Thanks for your feedback.
I'm running the wheezy image. The libraspberrypi-dev was already the latest version.
Any way to check specifically for the videocore lib?
Re: Turn on / off TV via HDMI CEC
Any news on this?
I want to do the exact same thing...
I want to do the exact same thing...
Re: Turn on / off TV via HDMI CEC
I'm still not able to compile with raspberry pi support...
Any input would be appreciated.
Let me know if you succeed.
Thanks.
Any input would be appreciated.
Let me know if you succeed.
Thanks.
-
- Posts: 2
- Joined: Wed Sep 19, 2012 4:16 pm
Re: Turn on / off TV via HDMI CEC
Installed the cec-client .. everything was looking good, but some minor problems. When I use something like:
echo "p 0000 1" | cec-client -s .. how can I use mnimun loglevel, I didn't succeed with -d 1 or anything like that? How about making some "macro" for the client? Something like this: echo "on;p 0000 1" | cec-client -s ?? And finally when I did some udev-rule for the bt-keyboard.. I was able to power on TV by connecting the bluetooth keyboard but then I try to change the hdmi output by echoing the cec-client -s .. not working, but if I started the cec-client and manually typed to change the HDMI.. everything works fine, what I am missing here?
echo "p 0000 1" | cec-client -s .. how can I use mnimun loglevel, I didn't succeed with -d 1 or anything like that? How about making some "macro" for the client? Something like this: echo "on;p 0000 1" | cec-client -s ?? And finally when I did some udev-rule for the bt-keyboard.. I was able to power on TV by connecting the bluetooth keyboard but then I try to change the hdmi output by echoing the cec-client -s .. not working, but if I started the cec-client and manually typed to change the HDMI.. everything works fine, what I am missing here?
Re: Turn on / off TV via HDMI CEC
@kokki : to set log level to minimum use "-d 1"
Ex : echo "on 0" | cec-client -d 1 -s
--------------------------------
I can't turn off the screen of my Samsung TV when using libcec cec-client;
It keeps saying the opcode 'standby' is not supported by my TV
Has anyone been able to turn the TV screen OFF using cec commands on a Samsung ?
How did you manage to turn it off?
Which Samsung model and firmware do you have ?
--------------------------------
The commands I use to turn it off (unsuccessfully) :
echo "tx 10 36" | cec-client -s or echo "standby 0" | cec-client -s
standby 0
DEBUG: [ 56474] << putting 'TV' (0) in standby mode
TRAFFIC: [ 56476] << 10:36
DEBUG: [ 56477] sending data: len = 1, payload = 10:36
DEBUG: [ 56538] received data: header:00020001 p0:00003610 p1:00000000 p2:00000000 p3:00000000 reason:1
DEBUG: [ 56539] command transmitted
DEBUG: [ 56660] received data: header:00040002 p0:04360001 p1:00000000 p2:00000000 p3:00000000 reason:2
TRAFFIC: [ 56661] >> 01:00:36:04
NOTICE: [ 56661] >> TV (0) -> Recorder 1 (1): feature abort ( 0)
DEBUG: [ 56661] marking opcode 'standby' as unsupported feature for device 'TV'
I can power off HDMI from the raspi with /opt/vc/bin/tvservice -o, but it doesn't turn off the TV screen that displays the message "No Signal"
Anynet+ (HDMI-CEC) is set to ON on the TV Settings
'Auto turn Off' is set to Yes.
"StandBy Mode Upgrade" is set to OFF
I can turn on TV : echo "on 0" | cec-client -s
I can change the source from TV Tuner to Raspi HDMI :
echo "as" | cec-client -s
or
echo "tx 1f 82 30 00" | cec-client -s
--------------------------------
My Configuration :
Samsung TV LE40A566P1M - XZF
TV Firmware v 1017 (the last one available)
Libcec, Debian Wheezy and Raspi Firmware are up to date
cec-client -i
libCEC version: 1.9.0, host: armv6l-unknown-linux-gnueabihf, features: 'P8 USB' 'P8 USB detect' 'RPi', git revision: 815dbda, compiled on: Wed Sep 26 10:18:45 UTC 2012 by root@raspberrypi on Linux 3.2.27+ (armv6l)
uname -a
Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l GNU/Linux
/opt/vc/bin/vcgencmd version
Sep 18 2012 01:44:00
Copyright (c) 2012 Broadcom
version 337601 (release)
--------------------------------
Usefull ressources regarding cec and libcec :
http://www.cec-o-matic.com/
http://selfprogramming.bplaced.net/?page=downloads
Ex : echo "on 0" | cec-client -d 1 -s
--------------------------------
I can't turn off the screen of my Samsung TV when using libcec cec-client;
It keeps saying the opcode 'standby' is not supported by my TV
Has anyone been able to turn the TV screen OFF using cec commands on a Samsung ?
How did you manage to turn it off?
Which Samsung model and firmware do you have ?
--------------------------------
The commands I use to turn it off (unsuccessfully) :
echo "tx 10 36" | cec-client -s or echo "standby 0" | cec-client -s
standby 0
DEBUG: [ 56474] << putting 'TV' (0) in standby mode
TRAFFIC: [ 56476] << 10:36
DEBUG: [ 56477] sending data: len = 1, payload = 10:36
DEBUG: [ 56538] received data: header:00020001 p0:00003610 p1:00000000 p2:00000000 p3:00000000 reason:1
DEBUG: [ 56539] command transmitted
DEBUG: [ 56660] received data: header:00040002 p0:04360001 p1:00000000 p2:00000000 p3:00000000 reason:2
TRAFFIC: [ 56661] >> 01:00:36:04
NOTICE: [ 56661] >> TV (0) -> Recorder 1 (1): feature abort ( 0)
DEBUG: [ 56661] marking opcode 'standby' as unsupported feature for device 'TV'
I can power off HDMI from the raspi with /opt/vc/bin/tvservice -o, but it doesn't turn off the TV screen that displays the message "No Signal"
Anynet+ (HDMI-CEC) is set to ON on the TV Settings
'Auto turn Off' is set to Yes.
"StandBy Mode Upgrade" is set to OFF
I can turn on TV : echo "on 0" | cec-client -s
I can change the source from TV Tuner to Raspi HDMI :
echo "as" | cec-client -s
or
echo "tx 1f 82 30 00" | cec-client -s
--------------------------------
My Configuration :
Samsung TV LE40A566P1M - XZF
TV Firmware v 1017 (the last one available)
Libcec, Debian Wheezy and Raspi Firmware are up to date
cec-client -i
libCEC version: 1.9.0, host: armv6l-unknown-linux-gnueabihf, features: 'P8 USB' 'P8 USB detect' 'RPi', git revision: 815dbda, compiled on: Wed Sep 26 10:18:45 UTC 2012 by root@raspberrypi on Linux 3.2.27+ (armv6l)
uname -a
Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l GNU/Linux
/opt/vc/bin/vcgencmd version
Sep 18 2012 01:44:00
Copyright (c) 2012 Broadcom
version 337601 (release)
--------------------------------
Usefull ressources regarding cec and libcec :
http://www.cec-o-matic.com/
http://selfprogramming.bplaced.net/?page=downloads
Re: Turn on / off TV via HDMI CEC
I know this may be a bit OT for this conversation, but you may also want to investigate SamyGo
http://sourceforge.net/projects/samygo/
Cheers
Richard
http://sourceforge.net/projects/samygo/
Cheers
Richard
{sig}
Pi1 [media]: Updated version Raspberry Pi (B, rev2, 512Mb), Samsung 58" Plasma (PN58C8000YFXZA), 8GB Class 6 SD Card with RaspBMC
Pi2 [webserver?]: Original Raspberry Pi (B, rev1, 256Mb), headless, 4Gb Class 6 SD Card
{/sig}
Pi1 [media]: Updated version Raspberry Pi (B, rev2, 512Mb), Samsung 58" Plasma (PN58C8000YFXZA), 8GB Class 6 SD Card with RaspBMC
Pi2 [webserver?]: Original Raspberry Pi (B, rev1, 256Mb), headless, 4Gb Class 6 SD Card
{/sig}
Re: Turn on / off TV via HDMI CEC
@XavM
Can't really help you here. I just can confirm that both "standby 0" and the raw tx-command work fine with my Philips TV.
Seems Samsung just didn't implement that feature.
Regards
Jens
Can't really help you here. I just can confirm that both "standby 0" and the raw tx-command work fine with my Philips TV.
Seems Samsung just didn't implement that feature.
Regards
Jens
Re: Turn on / off TV via HDMI CEC
Anybody get this working on Wheezy?
Re: Turn on / off TV via HDMI CEC
I've got a Wheezy install and used the instructions here:
http://selfprogramming.bplaced.net/inde ... rsion-190/
But I on cec-client -i get libcec version: 1.6.2
I follow these instructions
sudo dpkg -r libcec
sudo dpkg -i libcec_1.9.0-1_armhf.deb
and sometimes it upgrades to version 1.9.0 but then drops back on reboot. Even before reboot, it can't find any registered CEC devices.
Any ideas?
Thanks
Aman
http://selfprogramming.bplaced.net/inde ... rsion-190/
But I on cec-client -i get libcec version: 1.6.2
I follow these instructions
sudo dpkg -r libcec
sudo dpkg -i libcec_1.9.0-1_armhf.deb
and sometimes it upgrades to version 1.9.0 but then drops back on reboot. Even before reboot, it can't find any registered CEC devices.
Any ideas?
Thanks
Aman
Re: Turn on / off TV via HDMI CEC
I had the same issue with my Samsung TV. cec-client was reporting it didn't support the standby op-code so I enabled "Auto Turn Off" in the Anynet+ setup menu and now it works. If the TV does go into standby it doesn't turn off my Pi.
I've actually hooked this up to voice control and now when I say "raspberry on" the TV will turn it self on and switch to the correct input. If I say "raspberry tv" it will switch to the TV input and "raspberry off" it will turn the TV off
I've actually hooked this up to voice control and now when I say "raspberry on" the TV will turn it self on and switch to the correct input. If I say "raspberry tv" it will switch to the TV input and "raspberry off" it will turn the TV off

Re: Turn on / off TV via HDMI CEC
hi Eth0
can u post a link to the Voice control portion ? how did u implement on the PI ?:)
tx
can u post a link to the Voice control portion ? how did u implement on the PI ?:)
tx
Re: Turn on / off TV via HDMI CEC
+1 please share
eth0 wrote:I had the same issue with my Samsung TV. cec-client was reporting it didn't support the standby op-code so I enabled "Auto Turn Off" in the Anynet+ setup menu and now it works. If the TV does go into standby it doesn't turn off my Pi.
I've actually hooked this up to voice control and now when I say "raspberry on" the TV will turn it self on and switch to the correct input. If I say "raspberry tv" it will switch to the TV input and "raspberry off" it will turn the TV off
- georg.bartzos
- Posts: 15
- Joined: Sat Aug 17, 2013 3:55 pm
- Location: Germany
Re: Turn on / off TV via HDMI CEC
another easy (wheezy) way is ...
-- turn of tv --
$ /opt/vc/bin/tvservice -o
-- turn on tv --
$ /opt/vc/bin/tvservice -p
for more information:
$ tvservice -h

-- turn of tv --
$ /opt/vc/bin/tvservice -o
-- turn on tv --
$ /opt/vc/bin/tvservice -p
for more information:
$ tvservice -h

Re: Turn on / off TV via HDMI CEC
hi all,
i am interested in using this features. But i am not sure to understand all prerequisites... Do i need any special hardware in addition of an hdmi ?
Sincerly.
Arnaud
i am interested in using this features. But i am not sure to understand all prerequisites... Do i need any special hardware in addition of an hdmi ?
Sincerly.
Arnaud
Re: Turn on / off TV via HDMI CEC
Finally managed to get around the problem of using cec-client.
I tried downloading/compiling/using cec-client and always got a response like
pi@rpi-xbmc:~$ echo "on 0" | cec-client -s
DEBUG: [ 2] trying to autodetect all CEC adapters
autodetect FAILED
I had read about the issue that XBMC has its own cec-client, but was never able to find/use it.
echo "on 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
echo "standby 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
works out of the box to turn on/off my samsung tv via ssh.
I tried downloading/compiling/using cec-client and always got a response like
pi@rpi-xbmc:~$ echo "on 0" | cec-client -s
DEBUG: [ 2] trying to autodetect all CEC adapters
autodetect FAILED
I had read about the issue that XBMC has its own cec-client, but was never able to find/use it.
echo "on 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
echo "standby 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
works out of the box to turn on/off my samsung tv via ssh.
Re: Turn on / off TV via HDMI CEC
leinad - Registered here just to say huge thanks for posting this - I was looking for a way to do the same thing and it was driving me nuts!
Thanks!
Thanks!
leinad wrote:Finally managed to get around the problem of using cec-client.
I tried downloading/compiling/using cec-client and always got a response like
pi@rpi-xbmc:~$ echo "on 0" | cec-client -s
DEBUG: [ 2] trying to autodetect all CEC adapters
autodetect FAILED
I had read about the issue that XBMC has its own cec-client, but was never able to find/use it.
echo "on 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
echo "standby 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s
works out of the box to turn on/off my samsung tv via ssh.
-
- Posts: 2
- Joined: Tue Sep 16, 2014 5:48 pm
Re: Turn on / off TV via HDMI CEC
Hi all, I have a similar problem with my Samsung TV. I can turn it on, but not off. Full details here: http://www.raspberrypi.org/forums/viewt ... 51&p=0&e=0
Can anyone help?
Can anyone help?