Page 1 of 1

EasyOS / suspend option ? power buttons ?

Posted: Mon Jun 19, 2023 3:07 pm
by kris777

I have a question for more advanced EasyOS users.
I'm talking about the system option: suspend
On my old Samsung R780 laptop the option works but weird :D
Exactly, the laptop is put to sleep properly after closing the laptop cover, but waking up from the suspend option works in two phases, i.e. when I click on the power button, the system wakes up but for a moment. Then it goes back to the suspend option and only the second click wakes up EasyOS properly... a bit annoying :-)
Can it be fixed somehow? If needed, I'll give you some info about my laptop's configuration.
Ps.
after this command in the terminal, the system probably also goes to sleep ... but waking up works OK without double-clicking on the power button ... I need to check where to change it and whether it will be a good solution

Code: Select all

echo -n mem >/sys/power/state

Re: EasyOS / suspend option ?

Posted: Wed Jun 21, 2023 2:04 am
by BarryK

Last time that I tested suspend, after opening the laptop lid I pressed the power button and it came up ok.

The scripts to configure it are at /etc/acpi

...that hasn't been looked at in a very long time

There is 'acpid', a daemon that reads /etc/acpi
The script that starts the daemon is /etc/init.d/acpid


Re: EasyOS / suspend option ?

Posted: Wed Jun 21, 2023 4:30 pm
by kris777

I thought it was just my laptop but it seems to be a bug. I found something but I don't know how to use it.
https://bugs.archlinux.org/task/27201
Ps.
I think I found a solution ... but I admit that rather by accident :P
In the lid.sh file, I changed the entry so that the system, when performing the suspend option, knows whether the lid of the laptop is closed or open. File path is:

Code: Select all

/etc/acpi/lid.sh

the new entry is:

Code: Select all

if [[ `cat /proc/acpi/button/lid/LID0/state | awk '{print $2}'` = "closed" ]]
then
/usr/sbin/pm-suspend
fi

if we change the entry, we need to restart the acpid service

Code: Select all

/etc/init.d/acpid force-reload

maybe someone will find it useful ... or use it in the new version of EasyOS :thumbup2:
But isn't this an incorrect entry in the standard lid.sh file after all? :shock:

#!/bin/sh
/bin/grep -q open /proc/acpi/button/lid/LID/state && exit 0
/usr/sbin/pm-suspend

if i execute in terminal

Code: Select all

cat /proc/acpi/button/lid/LID/state
cat: /proc/acpi/button/lid/LID/state: No such file or directory

maybe there should be an entry

cat /proc/acpi/button/lid/LID0/state
state: open

I checked it was enough to change to LID0 !!! :shock: :lol:
best to check for yourself

Code: Select all

ls /proc/acpi/button/lid/
LID0

regards


Re: EasyOS / suspend option ? power buttons ?

Posted: Fri Jun 23, 2023 8:18 pm
by kris777

Hi @BarryK
Is this the intended purpose or is the wrong path to the file: power.sh ?
I was looking for why the power button does not work, i.e. why it does not perform any action, even just shutting down the system.
I changed the path:

Code: Select all

event=button/power PWRF
action=/etc/acpi/actions/power.sh

on

Code: Select all

event=button[ /]power
action=/etc/acpi/power.sh

and it's ok
And where to add this entry so that the screen lock will be activated after waking up from the suspend option?

Code: Select all

xlock -mode blank

Ps. I think I found a solution to running the program
xlock after resuming from suspend. I added the & character after the pm-suspend command and it works OK ? I don't know if all these fixes work only on my laptop? ...maybe it's specific settings but it works for me maybe others will find it useful to solve the problem.
Now the entry in lid.sh is like this:

Code: Select all

#!/bin/sh
/bin/grep -q open /proc/acpi/button/lid/LID0/state && exit 0
/usr/sbin/pm-suspend &
xlock -mode matrix

we have to reboot for it to work

Code: Select all

/etc/init.d/acpid force-reload

unfortunately, but after rebooting the system, it doesn't work, maybe something is turned off, maybe in the terminal you can read that :acpid ?
I added a fix to autostart with the entry ... and it's OK (it's a bit confusing and probably only on my laptop)
/root/Startup/acpid_fix

Code: Select all

#!/bin/sh
sleep 5
/etc/init.d/acpid force-reload

regards