• 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 11
XBMC on Pi: Add TV/monitor Power Save support when idle?
#61
(2014-03-07, 23:21)vbat99 Wrote: Seems it doesn't like calling my script if run from rc.local

It's calling your script OK, but the problem is that the PATH variable hasn't been set correctly now that its being called by rc.local, so cec-client can't be found when called from within your script.

Either set and export PATH in your startup script as it is defined for the user pi ("echo $PATH" to view it, then add "export PATH=<paths>" to you startup script, before the sleep), or alternatively specify the full path when calling cec-client in your /home/pi/mythtv.sh script - run "which cec-client" to see the full path and then use that full path when calling cec-client, ie. change:
Code:
echo "standby 0" | cec-client -s >/dev/nul
to
Code:
echo "standby 0" | /usr/bin/cec-client -s >/dev/nul

My choice would be to fix the PATH variable to avoid future problems, and running texturecache.py as the pi user (not root) would also avoid other problems (file ownership etc.) - maybe prefixing the call to texturecache.py with "su pi -c" will work, eg. "su pi -c /home/pi/texturecache.py @logfile=/home/pi/t3.txt etc."
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#62
Had to find where cec-client was located and for Raspbmc its in a couple of locations:
Code:
pi@raspbmc:/$ find . -name cec-client
./opt/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140305-nc3/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140213-nc3-2/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140306-nc3b/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140228-nc3/xbmc-bcm/xbmc-bin/bin/cec-client

The .upgrade path isn't viable, so made changes and set as
Code:
#!/bin/bash

/opt/vc/bin/tvservice $1

case "$1" in
  "--off")        echo "standby 0" | /opt/xbmc-bmc/xbmc-bin/bin/cec-client -s >/dev/null;;
  "--preferred")    echo "on 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s >/dev null;;
esac
echo "$(date) called with $1 param" >> /tmp/tvservice.log

But still have
Code:
2014-03-08 12:53:20.065752:Thread-1  : bin.tvservice (checking if TV is powered on) calling subprocess [/home/pi/mytv.sh --status]
2014-03-08 12:53:20.135903:Thread-1  : bin.tvservice response: [state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280x720 @ 60Hz, progressive]
2014-03-08 12:53:20.142789:Thread-1  : bin.tvservice (enabling/disabling HDMI) calling subprocess [/home/pi/mytv.sh --off]
2014-03-08 12:53:20.222834:Thread-1  : bin.tvservice response: [Powering off HDMI
/home/pi/mytv.sh: line 6: /opt/xbmc-bmc/xbmc-bin/bin/cec-client: No such file or directory]
2014-03-08 12:53:20.223948:Thread-1  : bin.tvservice (checking HDMI status) calling subprocess [/home/pi/mytv.sh --status]
2014-03-08 12:53:20.286904:Thread-1  : bin.tvservice response: [state 0x120002 [TV is off]]
2014-03-08 12:53:20.294417:Thread-1  : [DEBUG] HDMI is now off

Now, rc.local is
Code:
# By default this script does nothing.

sleep 20 && /home/pi/texturecache.py @logfile=/home/pi/t4.txt @debug=yes @xbmc.host=localhost @bin.tvservice=/home/pi/mytv.sh rbphdmi 420
exit 0
And I shoud change this to
Code:
sleep 20 && su pi -c /home/pi/texturecache.py @logfile=/home/pi/t4.txt @debug=yes @xbmc.host=localhost @bin.tvservice=/home/pi/mytv.sh rbphdmi 420
??

(Changed to 420 seconds so didn't have to wait as long)
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#63
(2014-03-08, 02:15)vbat99 Wrote: Had to find where cec-client was located and for Raspbmc its in a couple of locations:
Code:
pi@raspbmc:/$ find . -name cec-client
./opt/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140305-nc3/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140213-nc3-2/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140306-nc3b/xbmc-bcm/xbmc-bin/bin/cec-client
./home/pi/.upgrade/xbmc-13-20140228-nc3/xbmc-bcm/xbmc-bin/bin/cec-client

The .upgrade path isn't viable, so made changes and set as
Code:
#!/bin/bash

/opt/vc/bin/tvservice $1

case "$1" in
  "--off")        echo "standby 0" | /opt/xbmc-bmc/xbmc-bin/bin/cec-client -s >/dev/null;;
  "--preferred")    echo "on 0" | /opt/xbmc-bcm/xbmc-bin/bin/cec-client -s >/dev null;;
esac
echo "$(date) called with $1 param" >> /tmp/tvservice.log

But still have
Code:
2014-03-08 12:53:20.065752:Thread-1  : bin.tvservice (checking if TV is powered on) calling subprocess [/home/pi/mytv.sh --status]
2014-03-08 12:53:20.135903:Thread-1  : bin.tvservice response: [state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280x720 @ 60Hz, progressive]
2014-03-08 12:53:20.142789:Thread-1  : bin.tvservice (enabling/disabling HDMI) calling subprocess [/home/pi/mytv.sh --off]
2014-03-08 12:53:20.222834:Thread-1  : bin.tvservice response: [Powering off HDMI
/home/pi/mytv.sh: line 6: /opt/xbmc-bmc/xbmc-bin/bin/cec-client: No such file or directory]
2014-03-08 12:53:20.223948:Thread-1  : bin.tvservice (checking HDMI status) calling subprocess [/home/pi/mytv.sh --status]
2014-03-08 12:53:20.286904:Thread-1  : bin.tvservice response: [state 0x120002 [TV is off]]
2014-03-08 12:53:20.294417:Thread-1  : [DEBUG] HDMI is now off

You've got a typo in the path for cec-client - it should be:
Code:
/opt/xbmc-bcm/xbmc-bin/bin/cec-client
but for --off you've typed:
Code:
/opt/xbmc-bmc/xbmc-bin/bin/cec-client
("/opt/xbmc-bmc" when it should be "/opt/xbmc-bcm")

(2014-03-08, 02:15)vbat99 Wrote: And I shoud change this to
Code:
sleep 20 && su pi -c /home/pi/texturecache.py @logfile=/home/pi/t4.txt @debug=yes @xbmc.host=localhost @bin.tvservice=/home/pi/mytv.sh rbphdmi 420
??

Actually, you may need to wrap the command being executed in quotes so that it's treated as one argument and not several:
Code:
sleep 20 && su pi -c '/home/pi/texturecache.py @logfile=/home/pi/t4.txt @debug=yes @xbmc.host=localhost @bin.tvservice=/home/pi/mytv.sh rbphdmi 420' &
Give it a go, it should work. Note also that I've added the & on the end which should cause su to fork a new process, other you might find that rc.local processing doesn't finish... in fact with that in mind, I'd change your startup script to be as follows:
Code:
(sleep 20 && su pi -c '/home/pi/texturecache.py @logfile=/home/pi/t4.txt @debug=yes @xbmc.host=localhost @bin.tvservice=/home/pi/mytv.sh rbphdmi 420') &
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#64
YES!!! Yes yes yes!!!

It's A-Live!!

Thank you Sooooo much for persevering with me.

Don't know why I missed bmc suppose to be bcm I checked and re-checked before I posted. Dang it.

One Happy Chappy here!
(now to document it so I can remember it later.)
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#65
Glad you got there in the end! Smile
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#66
So I got slammed at home the other night, when the wife switch from the Pi (HDMI1) to Freeview TV (HDMI3), and after 15 minutes, the Pi switched off the TV. LOL.

Took me like 5 seconds to realize what had happened, while I was getting dirty looks from the other end of the room.

So, a question
  • Is it possible for the Pi to detect what the current TV's input is, and if not HDMI1, don't send the
    Code:
    echo "standby 0"
    command?

Little bit of googling looks like I have to figure out cec-client.

If this is Off topic for this thread, let me know.
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#67
(2014-03-17, 00:08)vbat99 Wrote: So, a question
  • Is it possible for the Pi to detect what the current TV's input is, and if not HDMI1, don't send the
    Code:
    echo "standby 0"
    command?

Little bit of googling looks like I have to figure out cec-client.

I would expect it is, the CEC-O-MATIC might provide some clues.

(2014-03-17, 00:08)vbat99 Wrote: If this is Off topic for this thread, let me know.

I'd say it has become OT as your remaining issues now concern generic CEC control rather than anything specific to enabling/disabling HDMI on the Pi when idle. Smile

A new thread with more appropriate title (and in the general section) may also get more eyes-on. Include a link here to any new thread as it may prove useful to anyone with the same problem.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#68
Thanks MilhouseVH

You've been a great help. Will post any relevant info here for future reference to other users.
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#69
(2014-03-17, 00:28)vbat99 Wrote: Thanks MilhouseVH

You've been a great help. Will post any relevant info here for future reference to other users.

Nevermind. I'm running OpenELEC and this is for Raspbmc, right?
Reply
#70
(2014-04-11, 17:10)schumi2004 Wrote: Nevermind. I'm running OpenELEC and this is for Raspbmc, right?

No, it should work with any Raspberry Pi distribution.

It's thoroughly tested on OpenELEC, but also works on Raspbmc with a bit of tweaking (basically just specify the location of the tvservice binary, and remove the unecessary delay that Raspbmc introduces before xbmc is restarted). No reason why it shouldn't also work with Xbian and Raspbian.

For OpenELEC, just follow the original instructions in post #12.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#71
I am running raspbmc and using texturecache.py I can indeed get the display to go to sleep and wakeup. It would be fine except for those nasty ¨relax raspbmc will restart" messages. I have gotten rid of the one in xbmc-watchdog.sh but that doesn really seem to have any effect.
Does anybody know where and how I can get rid of the "relax" dialog?
Reply
#72
(2014-05-09, 01:33)tkoorn Wrote: I am running raspbmc and using texturecache.py I can indeed get the display to go to sleep and wakeup. It would be fine except for those nasty ¨relax raspbmc will restart" messages. I have gotten rid of the one in xbmc-watchdog.sh but that doesn really seem to have any effect.
Does anybody know where and how I can get rid of the "relax" dialog?

So you did this?
Quote:You can eliminate the 10 second delay by commenting out the following line in /scripts/xbmc-watchdog.sh:
Code:
read -sn 1 -t 10 press < /dev/tty1

I've got the restart to approx 20 seconds, but it's still a lengthy delay, specially as it is an actual restart of XBMC.

Hopeful that popcornmix can fix the "virtual suspend" code for XBMC Helix....
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#73
(2014-05-09, 03:26)vbat99 Wrote: So you did this?
Quote:You can eliminate the 10 second delay by commenting out the following line in /scripts/xbmc-watchdog.sh:
Code:
read -sn 1 -t 10 press < /dev/tty1

Yes I did comment out that line but it had no effect. I still get the relax dialog andrestart takes about 40 sec.
Maybe I am editing the wrong file. there is also a file called console.py which looks like it also makes a relax dialog but I can't figure out where it is called from.
Reply
#74
Sorry, can't help any more than that.

I'd almost say that relax dialogue is in Rasmbmc...Thought I'm still on miappa's build and haven't gotten to Sam's Gotham release yet.
Media Companion Dev.
Media Companion - Kodi / XBMC - Media Companion
Reply
#75
Good news, with the latest Raspberry Pi firmware (23 May 2014 onwards) and texturecache.py v1.6.1, it is no longer necessary to restart xbmc.bin when re-enabling HDMI.

With the new firmware, "vcgencmd display_power 0" and "vcgencmd display_power 1" can be used to disable/enable HDMI. This method is less disruptive than "tvservice -o" or "tvservice -p", meaning that xbmc.bin doesn't need to be restarted.

The path to the vcgencmd binary will try to be determined automatically, defaulting to /usr/bin/vcgencmd (OpenELEC default) and then using "which" to determine alternative locations if required. When this binary cannot be located (or the disable_power command is not supported) then existing xbmc.bin restart behaviour will be used. Specify the path to vcgencmd with @bin.vcgencmd if it cannot be found automatically.

Now that @bin.tvservice will no longer be called to disable/enable HDMI whenever vcgencmd is used instead, I've added "@bin.ceccontrol" which can be set to the path of a script that will be called with "on" and "off" arguments whenever HDMI is enabled or disabled (either with tvservice or vcgencmd).

Note that @bin.tvservice is still be used to check initial HDMI status, so continue to specify @bin.tvservice if you're using a non-default path (/usr/bin/tvservice) value for this binary. Specify @bin.ceccontrol if you were using @bin.tvservice to implement additional CEC functionality whenever tvservice is called.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
  • 1
  • 3
  • 4
  • 5(current)
  • 6
  • 7
  • 11

Logout Mark Read Team Forum Stats Members Help
XBMC on Pi: Add TV/monitor Power Save support when idle?1
This forum uses Lukasz Tkacz MyBB addons.