2

I can currently switch on/off my Samsung TV from my Raspberry Pi (HDMI), and control XBMC from the samsung remote (pretty useful !).

Is there a way to handle a signal when I turn-on my TV, to start XBMC or an other program for example? Or when I switch to the right HDMI port (like when you switch to your DVD-player, and it automatically starts).

I looked at the cec-client, which is an "emitter" client and not a listener daemon. I didn't look at the libcec library.

Any idea?

I'm running rbpi-B with ArchLinux.

  • 1
    Why not keep XBMC running as long as the RPi is switched on? If you tweak it a little bit it will idle at about 20% load. So unless you wish the RPi to do any other demanding task just let XBMC be right there. – Ghanima Oct 8 '14 at 20:57
  • I think it would be a bad solution to check for the turn-on signal of your TV, as it isn't guaranteed that the TV and the RPi would reiceve the signal with the same success rate - if your TV is a bit flaky and your RPi reception is great, you might end up restarting XBMC 2-3 times before the TV turns on [use another button than the TV-power button]. You could build a circuit which knows when the TV is turned on, and starts XBMC when you turn on the TV, but that would be another question. – Jervelund Oct 9 '14 at 12:09
1

1. Why not keep XBMC running as long as the RPi is switched on? If you tweak it a little bit it will idle at about 20% load. So unless you wish the RPi to do any other demanding task just let XBMC be right there.

2. tvservice is the utility to handle HDMI status signals, such as HDMI cable unplugged.

/opt/vc/bin/tvservice -s outputs

state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

Unfortunately - at least with my setup Pi2B and Samsung TV - there is the same status reported for 1) TV in stand-by, 2) TV turned on and 3) Pi selected as HDMI source. So to the Pi there's no difference to detect.

/opt/vc/bin/tvservice -M (continous monitoring) however outputs

[I] HDMI cable is unplugged

[I] HDMI is attached

if the TV is turned on (from stand-by). So implementing the same callback that tvservice uses, it should be possible to trigger some event (such as starting xbmc) uppon turning on the TV. Unfortunately nothing is signaled during switching channels or turning off. It's noteworthy that other TV sets might behave differently - who knows.


See also: https://raspberrypi.stackexchange.com/a/46158/19949

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.