Page 1 of 1
Precise problem - Does not suspend when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 1:46 pm
by amethyst
I want my laptop to suspend to ram when closing the lid when using Precise. Where do I find the script that controls this? I think it should be in /etc/acpi/events but I don't see it in Precise. Bionic works like I want it to, suspends to ram. Is it maybe an acpitools thing, that it needs to be installed? Currently the light just turns off when the lid is closed using Precise but I think that may be a BIOS setting.
I copied over the acpi files from Bionic but it doesn't work in Precise (the suspend script in itself works but not when closing the lid). Anyone got this going in Precise....
Nevermind, got it sorted. There was a pet install for Precise I found on the old forum. I attach it here for Precise users. Install and restart X.
Re: Action when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 4:20 pm
by mikewalsh
@amethyst :-
Me, I just use the very simple suspend script frenchiveruti found a few years ago on the old Forum. No idea where he dug it up from, though I've seen it mentioned in a few places since:-
suspend.sh
Code: Select all
#!/bin/sh
#
#'Suspend' script for Puppy
#
echo -n mem > /sys/power/state
Lives in /usr/sbin, and has long been incorporated into a modified LogOut GUI, as well as being key-bound via /etc/xdg/templates/_root_jwmrc. I switch the wireless mouse off, followed by hitting 'Pause/Break' on the keyboard (I thought that was the most appropriate key for it, since I don't use it for owt else), and *off.....* she pops.
(If I don't disable the mouse first, the slightest movement of the sensor 'wakes' Puppy up again. She's a very light sleeper, y'know..! )
Different routine with a desktop PC, obviously.
Mike.
Re: Action when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 4:26 pm
by amethyst
mikewalsh wrote: ↑Thu Sep 02, 2021 4:20 pm
@amethyst :-
Me, I just use the very simple suspend script frenchiveruti found a few years ago on the old Forum. No idea where he dug it up from, though I've seen it mentioned in a few places since:-
Code: Select all
#!/bin/sh
#
#'Suspend' script for Puppy
#
echo -n mem > /sys/power/state
Lives in /usr/sbin, and has long been incorporated into a modified LogOut GUI, as well as being key-bound via /etc/xdg/templates/_root_jwmrc. I switch the wireless mouse off, followed by hitting 'Pause/Break' on the keyboard (I thought that was the most appropriate key for it, since I don't use it for owt else), and *off.....* she pops.
(If I don't disable the mouse first, the slightest movement of the sensor 'wakes' Puppy up again. She's a very light sleeper, y'know..! )
Different routine with a desktop PC, obviously.
Mike.
Yes, that is what I used before as a keystroke however you need acpi for the lid thingy.
Re: Action when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 4:45 pm
by 666philb
i think this worked for me on precise (a long long time ago)
Re: Action when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 5:59 pm
by williams2
My laptop would not stay suspended (it would immediately wake up.)
So I wrote a script to disable everything and anything permitted to wake it up.
Code: Select all
awk '/enabled/{print $1}' /proc/acpi/wakeup | while read a
do
echo "$a" > /proc/acpi/wakeup
done
Now, it suspends if I close the lid, and wakes up if I open the lid.
The mouse does not wake it.
Or I can execute /etc/acpi/actions/suspend.sh, which suspends without closing the lid.
Pressing any key wakes it.
The mouse does not wake it.
If you use a usb keyboard, probably the usb keyboard would not wake it.
Pressing the power button would probably wake it.
Also, I edited /etc/acpi/actions/suspend.sh slightly/
This would display an error message about the module built into the kernel, so I changed this:
rmmod ehci_hcd
to this:
rmmod ehci_hcd 2>/dev/null
And I wanted it to not suspend if a usb drive was plugged in, whether it was mounted or not, so I changed this:
# do not suspend if usb media mounted
to this:
probedisk2|grep -q '|usb' && exit
# do not suspend if usb media mounted
Re: Action when laptop lid is closed (SOLVED)
Posted: Thu Sep 02, 2021 11:37 pm
by mikewalsh
@amethyst :-
Yes, that is what I used before as a keystroke however you need acpi for the lid thingy.
.....and for which a desktop PC has no use. No lid, obviously.
Ye anciente Dell lappie has a magnetic 'reed' switch embedded in the middle front edge of the lid. Obviously intended to trigger such a function (I know it used to work when she ran XP, many years ago. Never been able to get it to work under Puppy, though...)
She doesn't get very much use nowadays.
Mike.
Re: Action when laptop lid is closed (SOLVED)
Posted: Tue Nov 09, 2021 8:53 pm
by JASpup
williams2 wrote: ↑Thu Sep 02, 2021 5:59 pm
Or I can execute /etc/acpi/actions/suspend.sh, which suspends without closing the lid.
Pressing any key wakes it.
The mouse does not wake it.
Interestingly on my 32 laptop in Xenial the three events:
running the suspend.sh script
running echo "mem" > /sys/power/state
closing my laptop lid
all do the blink for 1 second trick. Not sure what difference it makes if all are the same.
Does this need to be executed once each boot, or each time you suspend? I want to test it correctly.
Code: Select all
awk '/enabled/{print $1}' /proc/acpi/wakeup | while read a
do
echo "$a" > /proc/acpi/wakeup
done
Maybe Suspend has been too tricky to make an up-front Puppy function.
Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)
Posted: Tue Nov 09, 2021 11:39 pm
by williams2
Does this need to be executed once each boot
Probably executing it once each boot would work.
Plugging in a new usb device, like a usb keyboard, might enable that device to wake up the machine, which might make suspend not work. Or unplugging then replugging in a usb keyboard or mouse.
So you could run the script from the suspend script, so that it executes everytime the suspend script runs.
It's a very light script. it almost does nothing. If it's run a second time, it really does do nothing.
Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)
Posted: Wed Nov 10, 2021 4:50 am
by JASpup
williams2 wrote: ↑Tue Nov 09, 2021 11:39 pm
Probably executing it once each boot would work.
Plugging in a new usb device, like a usb keyboard, might enable that device to wake up the machine, which might make suspend not work. Or unplugging then replugging in a usb keyboard or mouse.
So you could run the script from the suspend script, so that it executes everytime the suspend script runs.
It's a very light script. it almost does nothing. If it's run a second time, it really does do nothing.
Shinobar's script works like a champ on my XP laptop. It posed the instant dilemma of where to put it.
- suspend-puppy-xp.png (2.68 KiB) Viewed 961 times
preliminary desktop placement
Tapping on the power button brings Xenialpup back to life. That is the same as XP. Walsh's idea of replacing Rebuild Menu in the logout gui could work (I see the usefulness of that button but always enter the command manually).
I think from reading other subject posts that we're probably suspending-to-ram [S3] vs. suspending-to-idle [S1] or standby [S2], but perhaps the sure check is in BIOS?
I will have to try williams2-suspend.sh back on the 7 netbook.
Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)
Posted: Wed Nov 10, 2021 8:29 am
by JASpup
In Tahr JWM the williams2 pre-suspend code takes care of the 7 netbook.
The only noticed distinction is the netbook will wake with any key, and the XP laptop requires the power button.
Re: Does not suspend when laptop lid is closed (SOLVED)
Posted: Thu Mar 24, 2022 2:13 am
by ozsouth
@williams2 - marvellous script! I have never been able to suspend under ubuntu clones (bionic64/fossa64) on a few of my laptops, but
I made your script executable & put it in /root/Startup as 'makesusp' so it will run on every startup, and suspend now works! Thankyou.