Quit XBMC when TV is off
|
10th May, 2013, 09:44 AM
Post: #1
|
|||
|
|||
Quit XBMC when TV is off
For the XBian maintainers: for the next XBMC release, can you modify/add the option to quit XBMC when turning off the TV?
Currently you have the option to suspend the PC when turning off the TV, it results in a call to application.Suspend() in peripherals.cpp, however I want the pi on all the time (I also have LAMP installed, check out http://renarin.zapto.org for statistics on my pi usage). Or you can modify the source to quit on "suspend_devices_advanced" XML option, which takes a list of deviced to suspend and is not currently wired in the XBMC GUI, or used that much for that matter by anyone. Modifying remote.xml is not working for the power button - I can assign XBMC.Quit() to any other button and it works, but not the power button. I've tried to make a CEC daemon to command XBMC, and noticed that pressing the power button results in a call to the CBCecCommand, but no call to CBCecKeyPress. The problem with the daemon is that when quitting XBMC, it stops getting any CEC traffic (although it starts working again when starting XBMC), but more importantly it stops responding (although it continues to run and show traffic after restarting XBMC, it will not quit, not even with CTRL-C). I'm guessing the XBMC cec client is adding a new recording device and de-registering my daemon. Any other suggestion to try and quit XBMC when powering off the TV? I've tried everything, and could not see other way than modifying the XBMC source. |
|||
10th May, 2013, 02:08 PM
Post: #2
|
|||
|
|||
RE: Quit XBMC when TV is off
how you start xbmc later ?
Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
10th May, 2013, 03:17 PM
Post: #3
|
|||
|
|||
RE: Quit XBMC when TV is off
modify the XBMC init.d script such that when XBMC exits it will start a libCEC program that monitors HDMI commands.
when the input source that the RPi is connected to becomes active (power on TV on HDMI input, or switch from TV to HDMI input), my program starts XBMC and then quits. this part is done and works. the issue is quitting XBMC with the remote control power button. |
|||
10th May, 2013, 03:47 PM
Post: #4
|
|||
|
|||
RE: Quit XBMC when TV is off
i checked xbmc sources and there is some space to provide this.
During receiving of CEC_STANDBY event, check is performed agains the parameters from rpi_cec xml file. pc_standby_if_tv_standby is checked for 1, then .Suspend() message is sent. Easy patch would add second line of tests, let's say comparing this parameter to '2', what would trigger .Quit() instead. But then It would be standard exit with result code 0. So, even better would be create new result code (different are defined for REBOOT, SHUTDOWN) like WAITCEC. For beta1, start job for XBMC is already this aware, so it would be just one test more for result code where you then put your "CEC wait for signal program". Feel free to provide the patch and send to Koennk. https://github.com/xbianonpi/xbian/issues/371 I opened issue, created patch (not tested) and copied it to the issue. You task now is approach koennk, coordinate with him during nightly compilation to include the patch, then download the specific build and test it. during test: in rpi_2708_1001.xml "standby_pc_on_tv_standby" should be set to 2. XBMC should exit with return code 50. mk Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
10th May, 2013, 04:38 PM
Post: #5
|
|||
|
|||
RE: Quit XBMC when TV is off
Thanks. I sent him a PM and see if it gets in a nightly build.
Cheers. |
|||
10th May, 2013, 09:54 PM
Post: #6
|
|||
|
|||
RE: Quit XBMC when TV is off
Added it: https://github.com/xbianonpi/xbian-patches/commit/fdfd9e1fa07fa53d430058d67dc9c95181057d89
Should come in automatically here: https://github.com/xbianonpi/xbmc-nightly/tree/Frodo Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
14th May, 2013, 09:08 PM
Post: #7
|
|||
|
|||
RE: Quit XBMC when TV is off
Probably a patch to XBMC will still not work, since the issue was in XBian xbmc init configuration.
/etc/init.d/xbmc echo $(start-stop-daemon -c xbian -u xbian -m --start --nicelevel $NICE --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS; RETURN=$?; case $RETURN in 64 ) splash --infinitebar --msgtxt="shutting down..."; sudo halt ;; 66 ) splash --infinitebar --msgtxt="rebooting..."; sudo reboot; ;; esac || return 2) &exit replace "sudo halt" with whatever command you want -- in my case I run a deamon that starts XBMC on TV HDMI routing change (when switching input to HDMI). Thanks Koenkk and mk01. |
|||
14th May, 2013, 11:40 PM
Post: #8
|
|||
|
|||
RE: Quit XBMC when TV is off
the patch was still part of the solution. I defined exit code to be 50 in that specific case you wanted to solve.
so the xbmc init script has to be updated for this new exit code. I was expecting info from you after testing, if the patch will make xbmc quit instead of sleep. if you this confirm, then we can update of xbmc init script accordingly to the patch and have "a complete solution". because if we alter init script and change sudo halt, then shutdown action will not work ... (and if it exiting with code 64, then the patch is not correct. from inside xbmc quitwait() should be called instead of original quit() or suspend() or others). If you have nightly and we want your solution to integrate to xbian distro, then I need from you following test. start the xbmc by hand from console by issuing Code: /usr/local/lib/xbmc/xbmc.bin --standalone ; echo $? ; pkill splash when xbmc exits, on console you shoud see a number (as the exit code) this should be 50 Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
14th May, 2013, 11:45 PM
Post: #9
|
|||
|
|||
RE: Quit XBMC when TV is off
I see, I'll try it out then. It should be in the next nightly build, I updated the patch since it did not took into consideration the XML -> the values in the XML are not 0, 1 and 2, but:
m_configuration.bPowerOffOnStandby = iStandbyAction == 13011 ? 1 : 0; m_configuration.bShutdownOnStandby = iStandbyAction == 13005 ? 1 : 0; m_configuration.bPowerOffOnStandby = iStandbyAction == 13009 ? 2 : 0; I defined 13009 for exit code 50. |
|||
15th May, 2013, 09:07 PM
Post: #10
|
|||
|
|||
RE: Quit XBMC when TV is off
it still exits with 64
The issue might be with the xbmc cec client, which starts with xbmc and notifies of "configuration updated" and overwrites the rpi XML file. Any idea how to fix that? Do I need to modify the XMLs and add a new entry in the menu? Or somehow define 13009 as valid value? modifying /usr/local/share/system/peripherals.xml and adding 13009 to the list of allowed values resulted in the QUIT option being available in the CEC options... testing now to see if it's working... Debugged, not working. There is nothing happening when "Ignore", "Quit" or "Suspend" are selected. Only when "Poweroff" is selected the log shows anything happening. |
|||
19th May, 2013, 02:48 PM
Post: #11
|
|||
|
|||
RE: Quit XBMC when TV is off
(15th May, 2013 09:07 PM)mihailescu2m Wrote: it still exits with 64 to be honest, no idea how the xml works. ok, let's try different approach. we can't modify (freely) xml, lets adapt xbmc to xml. that means I will change all actions on QuitWait. Code: if (adapter->m_configuration.bPowerOffOnStandby == 1) Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
19th May, 2013, 07:23 PM
Post: #12
|
|||
|
|||
RE: Quit XBMC when TV is off
Well, /usr/local/share/xbmc/system/peripherals.xml contains:
<setting key="standby_pc_on_tv_standby" type="enum" value="13011" label="36029" order="7" lvalues="36028|13005|13011" /> This allows you in the XBMC menu to select from the drop down on "When the TV is switched off" the options: Ignore (36028), Suspend, and Shutdown. Adding 13009 will allow you to select "Quit" from the menu, resulting in rpi_2708_1001.xml "standby_pc_on_tv_standby" set to 13009. Next, I am assuming that you need m_configuration.bPowerOffOnStandby = iStandbyAction == 13009 ? 2 : 0; line added to the patch as well. Then the code above. |
|||
20th May, 2013, 12:40 AM
Post: #13
|
|||
|
|||
RE: Quit XBMC when TV is off
(19th May, 2013 07:23 PM)mihailescu2m Wrote: m_configuration.bPowerOffOnStandby = iStandbyAction == 13009 ? 2 : 0; https://github.com/xbianonpi/xbian-patches/blob/master/xbmc/CECKnownCode.patch Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
23rd May, 2013, 05:33 PM
Post: #14
|
|||
|
|||
RE: Quit XBMC when TV is off
mk01 - it does not work.
Set to Suspend, Quit or Ignore does nothing, Set to Powerdown exits with 64 (even though it should exit with 50 now). So either the patch is not properly applied, or the code patched is not the one actually used with CEC events. I have no other idea |
|||
26th May, 2013, 10:44 AM
Post: #15
|
|||
|
|||
RE: Quit XBMC when TV is off
(23rd May, 2013 05:33 PM)mihailescu2m Wrote: mk01 - it does not work. I think we just took the other variable. I was not checking which one exactly it is from bPowerOffOnStandby or bShutdownOnStandby. so I took 1:1 chance. and seems wrong. will change the other one. mk Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
« Next Oldest | Next Newest »
|