Linux - Laptop and NetbookHaving a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Now create /etc/acpi/actions/lid-button.sh and copy this in it:
Quote:
#!/bin/sh
case "$2" in
LID0) echo -n mem >/sys/power/state ;;
*) logger "ACPI action undefined: $2" ;;
esac
Make the script executable:
Quote:
chmod +x /etc/acpi/actions/lid-button.sh
If that doesn't work you could comment this passage "echo -n mem >/sys/power/state ;;" (!!! Don't comment LID0)), and put in instead this passage "pm-suspend ;;" (without quotes).
And make sure acpid daemon is runing. You can chechk, i think, by this command (it will list you a lot of services):
Quote:
service --status-all
I must warn you that this script could conflict with gnome power-manager settings.
EDIT: i forgot to ask you. Do you have in mate enabled suspend when lid is closed in power manager settings?
That's what I find strange; I don't have "Power Management" in Mate, but it is set to suspend on lid close in Gnome and Gnome Classic.
And yes acpid is running.
I rebooted after each mod.
Didn't work. Just to make sure I edited the file properly; here it is as it stands:
#!/bin/sh
case "$2" in
LID0) pm-suspend ;;
*) logger "ACPI action undefined: $2" ;;
esac
What if you change the "pm-suspend" to "usr/sbin/pm-suspend" path?
I presume you mean the file " /etc/acpi/events/lid-suspend" and move to /usr/sbin. If so; no change.
By the way; thanks for all your work on this; much appreciated. I still find it weird why it works in Gnome and Classic.
I have filed a bug report.
Sorry i didn't make it clear. You have to edit /etc/acpi/actions/lid-suspend.sh file and in it change from pm-suspend to /usr/sbin/pm-suspend. And make it sure you made this script executable.
You could also try to move /etc/acpi/actions/lid-suspend.sh to /etc/acpi/lid-suspend.sh and, again, be sure the script is executable.
Change this too /etc/acpi/events/lid-suspend from:
Thanks for all your effort. I am going to paste all your suggestions into a doc; go back to square one and start over. My senior brain is having trouble connecting the dots. I'll get back when I've finished. I still wonder why it works in Gnome and Classic though.
Regards, Allan
OK went from start to finish. Even tried both "LID0) echo -n mem >/sys/power/state ;;" and "pm-suspend ;;" in acpi folder. Did the chmod thingy each time.
I notice in the acpi folder there is also a "lid.sh"
Tommorow i will try all suggestion i gave you on my familly's Ubuntu 10.04 which have, i think, similar if not exact acpi scripts. That way i will figure it out where i missed the point.
Don't give up we will work it out. I have archlinux which is more lucid (clean, not-preconfigured) in that way because, usually, it has vanilla packages and not all solutions that applies to archlinux applies also to Ubuntu/Mint.
Actually in Ubuntu 10's I couldn't get sleep or wireless to work at all on my laptop; all fine on the PC; where I have Win7, Ubuntu 11.10, Fedora (don't use much) and Suse (likewise). Admittedly I didn't try that hard; just used Win7. That's why I got more persistent with Mint 12; everything worked outa the box; more or less.
I notice in the acpi folder there is also a "lid.sh"
Hi AllanP,
lid.sh is the script that should do the trick. Thing is that your scirpt doesn't tell system to go to suspend :-) only to blank screen.
Recently I was fighting on my Debian Sid with suspend - it did suspend on lid close, but I wanted it to suspend on lid close only when laptop was on battery and when on AC, to stay just blanked.
You may try to use part of my script.
If you want to suspend on lid close regardless if ac adapter is on or off, change the following section:
from yor current:
Quote:
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
. /usr/share/acpi-support/screenblank
fi
to:
Quote:
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ] ; then
pm-suspend
fi
If you want to suspend on lid close only when AC adpater is unplugged, use the following:
Quote:
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ] ; then
grep -q 0 /sys/class/power_supply/AC/online
if [ $? = 0 ]; then
pm-suspend
fi
For me it works perfectly.
I did another thing. When AC is on, and lid is closed, I wanted to put it into suspend when unplugging the AC adapter (without opening the lid).
To get that I had to create new event to check the AC status on lid close.
In /etc/acpi/events I created file lid_ac with the following entries:
Quote:
# /etc/acpi/events/lid_ac
# Called when lid is closed and user unpluggs AC adapter
#
event=ac_adapter.*
action=/etc/acpi/lid_ac.sh
Now, you have to create the lid_ac.sh script in the actions folder (the same where lid.sh resides)
And the script in that folder is:
Quote:
#!/bin/sh
test -f /usr/share/acpi-support/state-funcs || exit 0
if [ $? = 0 ] ; then
grep -q 0 /sys/class/power_supply/AC/online
if [ $? = 0 ]; then
pm-suspend
fi
fi
Of course you have to make it executable with chmod +x command.
I'm not a scripter and maybe it's not very elegeant solution, but it does the trick for me and I don't have to use other power managers such as xfce4-power-manager (I run Enlightenment E17)
I hope I could help somebody
Last edited by Demonos; 05-19-2012 at 02:01 PM.
Reason: Some editorial changes to improve clarity
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.