Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Make only power button wake from suspend?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jroth
Tux's lil' helper
Tux's lil' helper


Joined: 08 Aug 2017
Posts: 76

PostPosted: Sun Oct 08, 2017 7:18 pm    Post subject: [Solved] Make only power button wake from suspend? Reply with quote

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
View user's profile Send private message
karmaking
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2004
Posts: 82
Location: Berlin, Germany

PostPosted: Thu Oct 12, 2017 10:34 am    Post subject: Reply with quote

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
View user's profile Send private message
jroth
Tux's lil' helper
Tux's lil' helper


Joined: 08 Aug 2017
Posts: 76

PostPosted: Tue Oct 17, 2017 9:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Oct 17, 2017 9:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Wed Oct 18, 2017 9:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
jroth
Tux's lil' helper
Tux's lil' helper


Joined: 08 Aug 2017
Posts: 76

PostPosted: Sat Oct 21, 2017 2:31 am    Post subject: Reply with quote

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
View user's profile Send private message
jroth
Tux's lil' helper
Tux's lil' helper


Joined: 08 Aug 2017
Posts: 76

PostPosted: Mon Nov 13, 2017 1:02 am    Post subject: Reply with quote

OK, I've solved it. It turns out you can control this from the OS, via a file called
Code:
/proc/acpi/wakeup


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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Wed Nov 15, 2017 2:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum