What DBus signal is sent on system suspend?
- by Paul Robinson
Hello,
I need to detect when a machine is going to sleep in Ubuntu 9.10 and Fedora 13. Both use UPower, so I've been looking on the "org.freedesktop.UPower" DBus bus for such signals.
I've been listening for the "sleeping" signal on the UPower bus with the following command:
dbus-monitor --system "type='signal',interface='org.freedesktop.UPower',member='Sleeping'"
When I sleep the machine (either by closing the lid, selecting "shutdown - suspend" or sending a DBus message) I don't see a "sleeping" event.
I notice that the "Sleeping" event is sent when the "org.freedesktop.UPower.AboutToSleep" method is invoked. I can do this manually by calling:
dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.AboutToSleep
And I notice the "sleeping" signal is fired. My understanding is that anything that sleeps the PC must send the "AboutToSleep" signal before hand. It doesn't seem like this is happening. I've tried these steps on both Fedora 13 and Ubuntu 9.10 and I see the same results.
Can anyone explain what's happening or provide me with an alternative DBus signal to listen for?
Many thanks,
Paul