You are not logged in.
Pages: 1
Topic closed
I just discovered how to do this... Put this in a script:
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Suspend \
int32:0
And execute that script, and presto, your system will suspend - absolutely no lxsession or anything needed, only HAL and pm-utils. Woo hoo!
Offline
Update: And use this for hibernate:
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate
Offline
Why not just run pm-suspend or pm-hibernate respectively?
thayer williams ~ cinderwick.ca
Offline
Because those have to be run as root... Using sudo is inconvenient for use with e.g. window manager menus, and using it with NOPASSWD strikes me as hackish...
So I guess that means I went to the trouble of looking this up for aesthetic reasons. Perhaps I should see a shrink.
Offline
Nice... I was using good ole' sudo with NOPASSWD for suspend/hibernate. Only addition that I made was to add this command as the first line:
xscreensaver-command -lock
I wanted my screen to be locked after recovering from hibernate/suspend.
Thanks for the info.
Offline
Because those have to be run as root...
hmm. that quite clever. why didn't i think of that! I always ran pm-* using NOPASSWD too.
Thanks for sharing
"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."
SETH / Jane Roberts
Offline
GJ, I'm not sure how you see using NOPASSWD as hackish, but writing out a long dbus command is not.
Still, nice to know.
Offline
I'm testing fedora out ATM, and there is this nifty command you may run as an ordinary user, IF you've got gnome-power-manager installed.
gnome-power-cmd.sh <suspend/hibernate/restart/shutdown>
It does it "properly" under gnome, i.e. activating screensaver and resuming removable devices correctly on resume, unlike the "raw" method posted above.
It's supposedly not fedora specific, but included with gnome-power-manager, so try it out.
What it does is something similar (just replace suspend with desired action);
dbus-send --session --dest=org.freedesktop.PowerManagement \
--type=method_call --print-reply --reply-timeout=2000 \
/org/freedesktop/PowerManagement \
org.freedesktop.PowerManagement.suspend
"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."
SETH / Jane Roberts
Offline
Aehm you dont need hal/pm-utils for suspending.
May i suggest
echo mem > /sys/power/state
?
:-)
Regards
raf
Last edited by raf_kig (2008-11-28 14:43:10)
Offline
Aehm you dont need hal/pm-utils for suspending.
May i suggestecho mem > /sys/power/state
?
:-)
Regards
raf
This looks cool.. /me googles
but!
- you need a shell to do the redirection
- you still need root priveleges because only root can write there
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Aehm you dont need hal/pm-utils for suspending.
May i suggestecho mem > /sys/power/state
While that's true, it doesn't accomodate quirks, which is the primary advantage of pm-utils. Then again, Gullible's script requires the HAL and DBUS daemons, and pm-utils requires DBUS, while the 'mem' requires neither. So it really just comes down to what you already have running on your system.
thayer williams ~ cinderwick.ca
Offline
- you need a shell to do the redirection
- you still need root priveleges because only root can write there
an appropriate sudoers entry solves that problem :-)
While that's true, it doesn't accomodate quirks, which is the primary advantage of pm-utils.
From my experience this is mostly not needed anymore. Nowadays all my machines 'just work' (used to be different a few years ago).
Regards
raf
Offline
dbus-send --system --print-reply --dest=org.freedesktop.Hal \ /org/freedesktop/Hal/devices/computer \ org.freedesktop.Hal.Device.SystemPowerManagement.Suspend \ int32:0
And execute that script, and presto, your system will suspend - absolutely no lxsession or anything needed, only HAL and pm-utils. Woo hoo!
For some reason, this works for me, but "gnome-power-cmd.sh suspend" does not. The dbus one puts my computer to sleep alright, but when I try to use gnome-power-cmd.sh or press the suspend button on my laptop, it beeps at me and does nothing. Neither the shutdown menu nor the power preferences menu give me the option of suspend (or hibernate, but I don't use that). This is really confusing me, because it worked fine under Ubuntu, and it works with pm-suspend and with pure HAL (the dbus command above), but not with GNOME for some reason.
The output of "gnome-power-cmd.sh suspend" is:
Suspending
Error org.freedesktop.DBus.GLib.UnmappedError.GpmControlError.Code0: Cannot suspend as not allowed from policy
Failed
Does anyone have any ideas for me? I'm in the hal and power groups, so I don't know why it's "not allowed from policy".
Offline
I have the problem that I can not suspend/hibernate my system at all, except for using the 'echo mem > /sys/power/state' trick found in this thread.
Trying the dbus command has this result:
anders@mars ~ $ dbus-send --system --print-reply --dest=org.freedesktop.Hal \
> /org/freedesktop/Hal/devices/computer \
> org.freedesktop.Hal.Device.SystemPowerManagement.Suspend \
> int32:0
method return sender=:1.0 -> dest=:1.309 reply_serial=2
int32 1
Do you know why, or how I can fix that? Any help would be greatly appreciated!
Offline
Sorry to bring this thread back from the dead but I seem to be having some permission problems with dbus:
Error org.freedesktop.Hal.Device.PermissionDeniedByPolicy: org.freedesktop.hal.power-management.suspend no <-- (action, result)
This happened to my Acer laptop a while ago since the suspend option in KDE suddenly stopped working. I simply thought it was a dodgy config. But then I tried it on my new laptop (ThinkPad SL500) and got the same with a fresh install with default configs.
At least acpid picks up Fn+F4
EDIT: I should also add that it works if I run it as root
Last edited by quantumphaze (2009-04-14 12:04:41)
▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁
Offline
Wiki: http://wiki.archlinux.org/index.php/HAL
I would say you have to edit /etc/PolicyKit/PolicyKit.conf like this:
<match user="$USER">
<match action="org.freedesktop.hal.power-management.suspend">
<return result="yes"/>
</match>
</match>
=> change the $USER to yours and restart hal, dbus and KDE.
...better to create a new post than resurect an old one ;-)
Offline
I disagree. When it's relevent, it's better to keep the old thread rather than duplicating.
[git] | [AURpkgs] | [arch-games]
Offline
Thanks, worked perfectly on my old laptop. Suspend from KDE now works fine on the new laptop, PolicyKit/HAL/DBus fixed itself somehow.
Last edited by quantumphaze (2009-04-17 13:47:33)
▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁
Offline
To continue on a related issue... what if pm-suspend does nothing? It doesn't even an error to the /var/logs
How can I see where the problem is?
Offline
What if pm-suspend does nothing?
Try this
echo mem > /sys/power/state
This talks to the system on a lower level than acpid or pm-utils. If that does nothing (remember that a locked up system is still something) then there are bigger problems.
Make sure that the packages acpi and acpid are installed and that you run pm-suspend from a root terminal, or better still as root in a tty.
▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁
Offline
Hi there,
I have to bring this up again. What is the damn comand for suspend/hibernating from userspace? I works fine if I use the lxde-logout programm, but what does that do??
the mentioned dbus entrys dont work for me:
$ dbus-send --session --dest=org.freedesktop.PowerManagement --type=method_call --print-reply --reply-timeout=2000 /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.suspend
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PowerManagement was not provided by any .service files
I have pm-utils installed and have a hook for locking my screen on suspend. This works well if I use the pm-suspend comand, but not with the lxde-logout programm. So I tried to find out what lxde-logout is doing to change it in that way that the hook is executed but I can't find the right stuff in the web.
Has Anyone any ideas? Please help.
Last edited by wombalton (2011-09-19 20:19:50)
Offline
wombalton,
this thread is over two years old. Please do not necropost: https://wiki.archlinux.org/index.php/Fo … Bumping.27
Best open a new thread of your own and link back here.
Closing this one.
To know or not to know ...
... the questions remain forever.
Offline
Pages: 1
Topic closed