Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Control Laptop Sleep
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
oneself
Tux's lil' helper
Tux's lil' helper


Joined: 02 Jul 2005
Posts: 98
Location: New York, NY

PostPosted: Tue Oct 09, 2012 4:05 pm    Post subject: Control Laptop Sleep Reply with quote

Hi,

I've been using laptop mode and acpi successfully for the past few months, and I've been very happy with it. However, I'd like to tweak its behavior a little bit. Specifically, if the laptop is connected to AC, I would like it to _not_ go to sleep when the lid is closed. Just blank out the screen.

I believe this is controlled by this script: /etc/acpi/actions/lm_lid.sh, which currently contains the following on my system:
Code:
#!/bin/bash                                                                                                           

#- #! /bin/sh                                                                                                         
# lid button pressed/released event handler                                                                           

#laptop mode helps minimized hdd activity                                                                             
test -x /usr/sbin/laptop_mode && /usr/sbin/laptop_mode auto

#get  the -xauth variable so we can access the display                                                                 
XAUTH="$( ps -C X f | sed -n 's/.*-auth \(.*\)/\1/p' )"
if [[ -z $XAUTH ]]
then
# if XAUTH is blank try another way to get it                                                                         
      XAUTH="$( ps -C xinit f | sed -n 's/.*-auth \(.*\)serverauth.*/\1Xauthority/p' )"
fi

#Find out if the lid is open or closed                                                                                 
if grep -q open /proc/acpi/button/lid/LID/state
then
       ACTION="on"
else
       ACTION="off"
fi

# turn the display off or back on                                                                                     
XAUTHORITY=$XAUTH /usr/bin/xset -display :0.0 dpms force $ACTION


I believe that the last line makes the laptop go to sleep. Is there any way I can tell it to only turn off the screen. Or figure out if I am currently on AC.

Thank you,
_________________
There are 10 types of people, those who know binary and those who don't.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2070

PostPosted: Tue Oct 09, 2012 5:00 pm    Post subject: Reply with quote

The last line only controls the screen, as in turn on/off, based on the values gathered through this script - it doesn't do anything related to putting the machine to sleep.

Look in the other files for clues, things like `pm-suspend` or `echo mem > /sys/power/state` etc are usually used.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
oneself
Tux's lil' helper
Tux's lil' helper


Joined: 02 Jul 2005
Posts: 98
Location: New York, NY

PostPosted: Tue Oct 09, 2012 7:51 pm    Post subject: Reply with quote

I'm not really sure what is suspending when the lid is being closed then.

I have a /usr/sbin/pm-suspend file which is a symlink to /usr/lib64/pm-utils/bin/pm-action.

Is that what's doing it? Is there a way to tell it to not suspend when on AC?
_________________
There are 10 types of people, those who know binary and those who don't.
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