Precise problem - Does not suspend when laptop lid is closed (SOLVED)

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Precise problem - Does not suspend when laptop lid is closed (SOLVED)

Post 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.

Attachments
acpid-suspend-0.0.1.pet
(5.91 KiB) Downloaded 56 times
Last edited by amethyst on Fri Sep 03, 2021 6:13 am, edited 2 times in total.
User avatar
mikewalsh
Moderator
Posts: 6154
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 792 times
Been thanked: 1979 times

Re: Action when laptop lid is closed (SOLVED)

Post 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..! :D)

Different routine with a desktop PC, obviously.

Mike. ;)

User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Re: Action when laptop lid is closed (SOLVED)

Post 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..! :D)

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.

User avatar
666philb
Posts: 429
Joined: Thu Jul 09, 2020 3:18 pm
Location: wales uk
Has thanked: 111 times
Been thanked: 149 times

Re: Action when laptop lid is closed (SOLVED)

Post by 666philb »

i think this worked for me on precise (a long long time ago) :)

Attachments
acpid-suspend-0.0.1.pet
(5.91 KiB) Downloaded 48 times
williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Action when laptop lid is closed (SOLVED)

Post 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

User avatar
mikewalsh
Moderator
Posts: 6154
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 792 times
Been thanked: 1979 times

Re: Action when laptop lid is closed (SOLVED)

Post 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. ;)

User avatar
JASpup
Posts: 1653
Joined: Sun Oct 04, 2020 10:52 am
Location: U.S.A.
Has thanked: 70 times
Been thanked: 89 times

Re: Action when laptop lid is closed (SOLVED)

Post 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:

  1. running the suspend.sh script

  2. running echo "mem" > /sys/power/state

  3. 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. :?

On the Whiz-Neophyte Bridge
Linux Über Alles
Disclaimer: You may not be reading my words as posted.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)

Post 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.

User avatar
JASpup
Posts: 1653
Joined: Sun Oct 04, 2020 10:52 am
Location: U.S.A.
Has thanked: 70 times
Been thanked: 89 times

Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)

Post 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
suspend-puppy-xp.png (2.68 KiB) Viewed 957 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.

On the Whiz-Neophyte Bridge
Linux Über Alles
Disclaimer: You may not be reading my words as posted.

User avatar
JASpup
Posts: 1653
Joined: Sun Oct 04, 2020 10:52 am
Location: U.S.A.
Has thanked: 70 times
Been thanked: 89 times

Re: Precise problem - Does not suspend when laptop lid is closed (SOLVED)

Post 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.

On the Whiz-Neophyte Bridge
Linux Über Alles
Disclaimer: You may not be reading my words as posted.

ozsouth
Posts: 1564
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 241 times
Been thanked: 700 times

Re: Does not suspend when laptop lid is closed (SOLVED)

Post 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.

Post Reply

Return to “Users”