Kodi Community Forum
How does xbmc call suspend? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: How does xbmc call suspend? (/showthread.php?tid=200326)



How does xbmc call suspend? - iitywygms - 2014-07-21

Hi All:

Can someone please tell me how xbmc goes into suspend when you push the button on the remote or select suspend from the exit menu?
It must call up a script or something that puts the computer into suspend. I was hoping someone could tell me the name and location of that script.
Ubuntu 14.04 and xbmc Gotham.
Thanks to all.


RE: How does xbmc call suspend? - janumix - 2014-07-21

/etc/pm/sleep.d

BR
Janusz


RE: How does xbmc call suspend? - wsnipex - 2014-07-21

depends on which methods are available on the target system: logind, upower, consolekit...
see https://github.com/yasij/xbmc/blob/logind_default_suspend/xbmc/powermanagement/PowerManager.cpp#L73


RE: How does xbmc call suspend? - iitywygms - 2014-07-21

okay thanks guys.
I was going to try and create a way for mythtv to use the built in suspend of xbmc but it does not seem that simple.
thanks for the info.


RE: How does xbmc call suspend? - teeedubb - 2014-07-21

You can trigger xbmcs suspend function via jsonrpc or xbmc-send.


RE: How does xbmc call suspend? - iitywygms - 2014-07-21

(2014-07-21, 17:04)teeedubb Wrote: You can trigger xbmcs suspend function via jsonrpc or xbmc-send.

Okay, but xbmc needs to be running for that to be true yes?
Appreciate the help.


RE: How does xbmc call suspend? - topfs2 - 2014-07-21

Most of the ways use dbus. Which you can invoke via dbus-send.


RE: How does xbmc call suspend? - iitywygms - 2014-07-21

Okay thanks for the info.
I will try and figure out the dbus method.
Appreciate the info.


RE: How does xbmc call suspend? - topfs2 - 2014-07-21

Here is the UPower sleep message as an example. https://github.com/xbmc/xbmc/blob/master/xbmc/powermanagement/linux/UPowerSyscall.cpp#L117
Which if memory serves me correctly
dbus-send --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


RE: How does xbmc call suspend? - iitywygms - 2014-07-21

I am testing over ssh right now so I cant be sure but I believe this one will work.
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

I get this error but I believe it is caused from using ssh
Error org.freedesktop.UPower.GeneralError: not authorized

With the one you suggest I get the following error.
Must use org.mydomain.Interface.Signal notation, no dot in "/org/freedesktop/UPower"


RE: How does xbmc call suspend? - teeedubb - 2014-07-21

This is what works for me in xbmcbuntu13

Code:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend



RE: How does xbmc call suspend? - iitywygms - 2014-07-22

This worked for me.

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Thank you to all for helping out a novice like me. It is really apreciated.