Forum
XBMC kill when RPi are in Standby - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Kodi (/forum-18.html)
+--- Thread: XBMC kill when RPi are in Standby (/thread-2040.html)



XBMC kill when RPi are in Standby - Blightrt - 20th Jan, 2014 07:04 AM

Hello,

i search for a solution, that kills XBMC when i turn off my TV and when i turn on my TV it starts XBMC.

It should relieve the CPU and to have more power for other programs, like pyload or downloaddeamon

I think it would be work when CEC is disconnect with a script or on a button on my remote.

Any Idea? Thanks in Advance


RE: XBMC kill when RPi are in Standby - IriDium - 21st Jan, 2014 05:35 AM

Something similar has been discussed elsewhere.

In essence, it shouldn't really be needed as XBian in "Non" usage uses so little CPU as to be insignificant - in fact a program running in the background checking for an input every ~500ms will probably consume more CPU than just letting Xbian do nothing.

I'm sure they might be a clever way around this but I on't know of it - maybe someone else does.


RE: XBMC kill when RPi are in Standby - mk01 - 25th Jan, 2014 05:25 PM

when XBMC starts screensaver, XBIAN changes XBMC's priority to very very low. this together with taking only 15% by default, is not taking more than 5-7% of cpu time.

but still if you want to kill it, there is upstart script "xbmc-screensaver". when this changes state to "running", you know XBMC turned on screensaver. then you can create very simple upstart job like this:
Code:
start on started xbmc-screensaver

exec stop xbmc

with running xbmc back on you have a play a bit, but one of the solutions would be enhance this job for a loop which is asking TV status. if is not "standby", start xbmc

Code:
start on started xbmc-screensaver

pre-start exec stop -qn xbmc || :

script
   while :; do
      echo "pow 0" >> /run/cc/in
      [ "$(tail -1 /run/cc/out)" = standby ] || break
   done
end script

post-stop start -nq xbmc || :



RE: XBMC kill when RPi are in Standby - Blightrt - 26th Jan, 2014 02:29 AM

Thanks for your help


RE: XBMC kill when RPi are in Standby - LeoSum - 14th Mar, 2014 03:58 AM

Hey mk01,
I am looking for something exactly like you are supposing but I am struggling to understand your post.
  • What is happening inside the brackets? Is this the command for checking the CEC status?
  • How do I make this script start running everytime the pi boots?

CEC works with my tv as I can use the remote to control my pi when I am in xbmc. But via ssh using tvservice -M i cannot register any events from the TV when I switch sources or turn it on or off.


RE: XBMC kill when RPi are in Standby - mk01 - 16th Mar, 2014 08:16 AM

(14th Mar, 2014 03:58 AM)LeoSum Wrote:  Hey mk01,
I am looking for something exactly like you are supposing but I am struggling to understand your post.
  • What is happening inside the brackets? Is this the command for checking the CEC status?
  • How do I make this script start running everytime the pi boots?

CEC works with my tv as I can use the remote to control my pi when I am in xbmc. But via ssh using tvservice -M i cannot register any events from the TV when I switch sources or turn it on or off.

monitor mode doesn't work natively in libCEC and direct access to libCEC controls disables other open sessions.

enable SCREENOFF=yes in /etc/default/xbmc

this will upon start of xbmc create shared in and out files at /run/cc/in,out

then independently on running XBMC you can issue commands to cec bus as follows

echo "command" >> /run/cc/in

and read what is returned "cat or tail /run/cc/out"

if you need messages from 3rd devices (like promisc mode), then we need a small change in the code.