View previous topic :: View next topic |
Author |
Message |
jroth Tux's lil' helper
Joined: 08 Aug 2017 Posts: 76
|
Posted: Sun Oct 08, 2017 7:18 pm Post subject: [Solved] Make only power button wake from suspend? |
|
|
So I'm running Gentoo with Systemd, and I put the system to sleep with:
Code: | # systemctl suspend |
and then tapping the power button, clicking the mouse, or pressing a key can all wake the system up from suspend. Thing is, it does not like to be woken up with keyboard or mouse click. When it wakes up that way, the screen powers up but remains black, and I think that X has crashed. Also, I just sometimes bump the keyboard or mouse on my desk when I don't mean to and am doing other things.
So I think it would be best to configure it so that only a power button tap can wake it up from suspend. Anyone know how to do that?
Last edited by jroth on Mon Nov 13, 2017 1:03 am; edited 1 time in total |
|
Back to top |
|
|
karmaking Tux's lil' helper
Joined: 11 Feb 2004 Posts: 82 Location: Berlin, Germany
|
Posted: Thu Oct 12, 2017 10:34 am Post subject: |
|
|
On which events the computer wakes from suspend is usually controlled in the BIOS setup of your computer, not in any system settings. Have you checked if there are any "wake up" or power management options?
Cheers,
Daniel |
|
Back to top |
|
|
jroth Tux's lil' helper
Joined: 08 Aug 2017 Posts: 76
|
Posted: Tue Oct 17, 2017 9:21 pm Post subject: |
|
|
karmaking wrote: | On which events the computer wakes from suspend is usually controlled in the BIOS setup of your computer, not in any system settings. Have you checked if there are any "wake up" or power management options?
Cheers,
Daniel |
I dug through the BIOS settings and didn't find anything that would control wake up. Is there anyway to fix this from within Gentoo? |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Tue Oct 17, 2017 9:33 pm Post subject: |
|
|
Moved from Portage & Programming to Kernel & Hardware on request.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3131
|
Posted: Wed Oct 18, 2017 9:18 pm Post subject: |
|
|
Quote: | I dug through the BIOS settings and didn't find anything that would control wake up. Is there anyway to fix this from within Gentoo? | I honestly doubt it. I don't think CPU is in control at this time, that would kinda defeat the purpose of suspend mode. You know, you want to power off as many circuits as possible, when you wait for an interrupt. I'd expect to find this logic somewhere in the south bridge... Close to the "interface devices" |
|
Back to top |
|
|
jroth Tux's lil' helper
Joined: 08 Aug 2017 Posts: 76
|
Posted: Sat Oct 21, 2017 2:31 am Post subject: |
|
|
szatox wrote: | Quote: | I dug through the BIOS settings and didn't find anything that would control wake up. Is there anyway to fix this from within Gentoo? | I honestly doubt it. I don't think CPU is in control at this time, that would kinda defeat the purpose of suspend mode. You know, you want to power off as many circuits as possible, when you wait for an interrupt. I'd expect to find this logic somewhere in the south bridge... Close to the "interface devices" |
Hm, OK. In that case, is there anything I can do to diagnose the fact that when I wake it up with a mouse click, the computer wakes up but the screen remains black and unresponsive? |
|
Back to top |
|
|
jroth Tux's lil' helper
Joined: 08 Aug 2017 Posts: 76
|
Posted: Mon Nov 13, 2017 1:02 am Post subject: |
|
|
OK, I've solved it. It turns out you can control this from the OS, via a file called
That file tells you what things are enabled to wake the system up. You can toggle their state by (as root) echoing the name of the device at the file, for example:
Code: |
# echo PS2K > /proc/acpi/wakeup
|
that would toggle the wake-up state of my PS2 keyboard. I wrote this script which will disable all of the devices except for my power button (called PWRB):
Code: |
#!/bin/bash
for f in $(cat /proc/acpi/wakeup | grep "enabled" | grep -v "PWRB" | cut -d ' ' -f 1)
do
echo $f > /proc/acpi/wakeup
done
|
Then configured SystemD to run that script on boot. The state of /proc/acpi/wakeup appears to be preserved after waking up from suspend, at least on my machine. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Wed Nov 15, 2017 2:52 am Post subject: |
|
|
That script could be greatly simplified. Remove the useless use of cat. Fold the two text searches into a single gawk program. Use gawk's word splitting to replace the cut: Code: | gawk '/enabled/ && ! /PWRB/ { print $1; }' < /proc/acpi/wakeup | while read f; do
echo "$f" > /proc/acpi/wakeup
done |
|
|
Back to top |
|
|
|