LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 11-03-2008, 09:44 PM   #1
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Rep: Reputation: 16
ACPI configuration for lid


Yes it is another post concerning lid & standby.
When I do echo -n mem > /sys/power/state in terminal my laptop goes down and when I close and reopen my lid and everything is back and working ok!

I consider this post for help me out to configure the closing part for my lid by what Fluxx posted and I quote:
his lid.sh file
Quote:
#!/bin/sh

# discover video card's ID
ID=`/sbin/lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`

# securely create a temporary file
TMP_FILE=`mktemp /tmp/video_state.XXXXXX`
trap 'rm -f $TMP_FILE' 0 1 15

# switch to virtual terminal 1 to avoid graphics
# corruption in X
chvt 1

/sbin/hwclock --systohc

# write all unwritten data (just in case)
sync

# dump current data from the video card to the
# temporary file
cat /proc/bus/pci/$ID > $TMP_FILE

# suspend-to-ram
echo -n mem > /sys/power/state

# suspend-to-disk
# echo -n disk > /sys/power/state

/sbin/hwclock --hctosys

# restore video card data from the temporary file
# on resume
cat $TMP_FILE > /proc/bus/pci/$ID

# switch back to virtual terminal 7 (running X)
chvt 7

# remove temporary file
rm -f $TMP_FILE
and then he added 2 lines in his lid file in
/etc/acpi/events
Quote:
event=button[ /]lid.*
action=/etc/acpi/actions/lid.sh
but for me this script do not work properly.
When I close the lid the laptop goes to standby
but when I reopen the lid there is a 1sec on comming back for standby but imadiatly going back to standby therefore I need to repress the power button to bring up from standby.

My question is how do I fix this problem?
Can I add just some lines in the acpi_handler.sh?

Please help me out
thank you
 
Old 11-03-2008, 10:17 PM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
This is my acpi_handler.sh:

Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions
 
IFS=${IFS}/
set $@
 
case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
        lid) su dive -c /home/dive/scripts/suspendlock
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
Change my suspendlock script for yours.
 
Old 11-04-2008, 03:25 PM   #3
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
Did not work for me!
Just to make sure, Dive your suspendlock is a .sh file or it is like an event one?
Also
Can it be my lid.sh file that I use (it is posted at the begining)?
I just realise that Fluxx's(that I used) script do not do the resume on an open lid just on a button.
So I thing that is the problem but what script Should I use!!

thank you

Last edited by rssn6; 11-04-2008 at 03:30 PM. Reason: add stuff
 
Old 11-04-2008, 05:24 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
Yes the suspendlock is just a sh file similar to lid.sh. Just put the location of your lid.sh and you can take out the 'su dive -c' part.

Make sure you remove or comment out the lines in your old events file so only one is used at a time though.

If it is still going into suspend right after resuming then it looks like a problem with acpi seeing the lid button event twice. You may want to check your acpi log to see whats happening.

Last edited by dive; 11-04-2008 at 05:26 PM.
 
Old 11-04-2008, 09:41 PM   #5
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dive View Post
Yes the suspendlock is just a sh file similar to lid.sh. Just put the location of your lid.sh and you can take out the 'su dive -c' part.

Make sure you remove or comment out the lines in your old events file so only one is used at a time though.

If it is still going into suspend right after resuming then it looks like a problem with acpi seeing the lid button event twice. You may want to check your acpi log to see whats happening.
Thank you for the clarification. But what I found very strange is that when I pass echo -n mem > /sys/power/state in the terminal without the lid script then I close the lid and reopen everything goes back to normal.

With the script active when I close or use the terminal command after reopening the lid it goes to standby after a sec of power up.
 
Old 11-04-2008, 10:37 PM   #6
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
Wht happens if you comment out everything except 'echo -n mem > /sys/power/state' in the script?

I found with my laptop that I didn't need all the extra commands except 'sync' for suspend.
 
Old 11-05-2008, 08:38 AM   #7
w1k0
Member
 
Registered: May 2008
Posts: 934

Rep: Reputation: 107Reputation: 107
rssn6: are you sure the below line in your script is commented?

# echo -n disk > /sys/power/state

I just tried your lid.sh script and it works properly in my Slackware 12.1.
 
Old 11-05-2008, 09:02 AM   #8
w1k0
Member
 
Registered: May 2008
Posts: 934

Rep: Reputation: 107Reputation: 107
rssn6: I just managed to achieve the result you described in your first post. I pushed lid fast to down and to up without closing it entirely. If I close it your lid.sh script works well for me.
 
Old 11-05-2008, 08:35 PM   #9
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
Back with comments.
I do not have any log file for acpi.
I try all your suggestions but no good results.
Same thing happens.

any other suggestions ?

thank you for all your replies

Last edited by rssn6; 11-05-2008 at 08:36 PM. Reason: add stuff
 
Old 11-05-2008, 09:15 PM   #10
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
You should have a /var/log/acpid containing entries like

[Mon Sep 29 23:06:32 2008] received event "button/lid LID 00000080 00000001"
[Mon Sep 29 23:06:32 2008] notifying client 2846[82:82]
[Mon Sep 29 23:06:32 2008] notifying client 8536[0:100]
[Mon Sep 29 23:06:32 2008] executing action "/etc/acpi/acpi_handler.sh button/lid LID 00000080 00000001"

Try closing/opening the lid a few times and look in the log. I'm not sure where you can go from here but the log may show something.
 
Old 11-05-2008, 09:26 PM   #11
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dive View Post
You should have a /var/log/acpid containing entries like

[Mon Sep 29 23:06:32 2008] received event "button/lid LID 00000080 00000001"
[Mon Sep 29 23:06:32 2008] notifying client 2846[82:82]
[Mon Sep 29 23:06:32 2008] notifying client 8536[0:100]
[Mon Sep 29 23:06:32 2008] executing action "/etc/acpi/acpi_handler.sh button/lid LID 00000080 00000001"

Try closing/opening the lid a few times and look in the log. I'm not sure where you can go from here but the log may show something.
ok here is my acpi log
Code:
client has disconnected
completed event "ac_adapter AC 00000080 00000001"
received event "button/lid LID 00000080 00000005"
notifying client 2977[82:82]
executing action "/etc/acpi/lid.sh"
BEGIN HANDLER MESSAGES
END HANDLER MESSAGES
action exited with status 0
completed event "button/lid LID 00000080 00000005"
client connected from 3068[0:0]
1 client rule loaded
received event "battery BAT0 00000081 00000001"
notifying client 2977[82:82]
notifying client 3068[0:0]
client has disconnected
completed event "battery BAT0 00000081 00000001"
received event "battery BAT0 00000080 00000001"
notifying client 2977[82:82]
completed event "battery BAT0 00000080 00000001"
client connected from 3068[0:0]
1 client rule loaded
received event "ac_adapter AC 00000080 00000001"
notifying client 2977[82:82]
notifying client 3068[0:0]
completed event "ac_adapter AC 00000080 00000001"
received event "battery BAT0 00000081 00000001"
notifying client 2977[82:82]
notifying client 3068[0:0]
completed event "battery BAT0 00000081 00000001"
received event "battery BAT0 00000080 00000001"
notifying client 2977[82:82]
notifying client 3068[0:0]
 
Old 11-05-2008, 10:06 PM   #12
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
According to that log acpi_handler.sh isn't running but lid.sh is.

Did you remove the entries from /etc/acpi/events and just use acpi_handler.sh as I put it above? If not, try it. Something like the following:

Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions
 
IFS=${IFS}/
set $@
 
case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
        lid) /etc/acpi/actions/lid.sh
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
Also make sure that lid.sh only contains echo -n mem > /sys/power/state

Last edited by dive; 11-05-2008 at 10:11 PM.
 
Old 11-05-2008, 11:44 PM   #13
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
Dive, presently that is my acpi_handler.sh
Code:
#!/bin/sh
# Default acpi script that takes an entry for all actions

IFS=${IFS}/
set $@

case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
	lid)  /etc/acpi/lid.sh
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac
my events folder has just default:
Code:
event=button power.*
action=/etc/acpi/acpi_handler.sh %e

event=button[ /]lid.*
action=/etc/acpi/acpi_handler.sh
and my lid.sh file has:
Code:
/bin/sh

# discover video card's ID
##ID=`/sbin/lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`

# securely create a temporary file
##TMP_FILE=`mktemp /tmp/video_state.XXXXXX`
##trap 'rm -f $TMP_FILE' 0 1 15

# switch to virtual terminal 1 to avoid graphics
# corruption in X
##chvt 1

##/sbin/hwclock --systohc

# write all unwritten data (just in case)
##sync

# dump current data from the video card to the
# temporary file
##cat /proc/bus/pci/$ID > $TMP_FILE

# suspend-to-ram
echo -n mem > /sys/power/state

# suspend-to-disk
# echo -n disk > /sys/power/state

##/sbin/hwclock --hctosys

# restore video card data from the temporary file
# on resume
##cat $TMP_FILE > /proc/bus/pci/$ID

# switch back to virtual terminal 7 (running X)
##chvt 7

# remove temporary file
##rm -f $TMP_FILE
with this code when I close my lid it do not go to standby...

Please help me out I'm so confused!
 
Old 11-06-2008, 07:34 AM   #14
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,061

Rep: Reputation: 214Reputation: 214Reputation: 214
/etc/acpi/events/default should be:

Code:
event=.*
action=/etc/acpi/acpi_handler.sh %e
The first line in your lid.sh should be:

#!/bin/sh

Also check the location of your lid.sh script. Earlier you said it was at /etc/acpi/actions/lid.sh

If it is then move it to /etc/acpi/

Last edited by dive; 11-06-2008 at 08:04 AM.
 
Old 11-06-2008, 08:46 AM   #15
rssn6
Member
 
Registered: Jun 2008
Location: Canada
Distribution: Slackware,Ubuntu, m0n0wall,Freenas
Posts: 66

Original Poster
Rep: Reputation: 16
ok I corrected the problem, now my laptop goes to standby but open I reopen it goes up and down very quickly, then I press the button and it goes up and then again down... I have to press the button 3 times to bring it up!!!

maybe put and argument for open/close in acpi_handler.sh?

my acpid log
Code:
[Thu Nov  6 09:56:07 2008] BEGIN HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] END HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] action exited with status 0
[Thu Nov  6 09:56:07 2008] completed event "ac_adapter AC 00000080 00000001"
[Thu Nov  6 09:56:07 2008] received event "battery BAT0 00000081 00000001"
[Thu Nov  6 09:56:07 2008] notifying client 2975[82:82]
[Thu Nov  6 09:56:07 2008] notifying client 3066[0:0]
[Thu Nov  6 09:56:07 2008] executing action "/etc/acpi/acpi_handler.sh battery BAT0 00000081 00000001"
[Thu Nov  6 09:56:07 2008] BEGIN HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] END HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] action exited with status 0
[Thu Nov  6 09:56:07 2008] completed event "battery BAT0 00000081 00000001"
[Thu Nov  6 09:56:07 2008] received event "battery BAT0 00000080 00000001"
[Thu Nov  6 09:56:07 2008] notifying client 2975[82:82]
[Thu Nov  6 09:56:07 2008] notifying client 3066[0:0]
[Thu Nov  6 09:56:07 2008] executing action "/etc/acpi/acpi_handler.sh battery BAT0 00000080 00000001"
[Thu Nov  6 09:56:07 2008] BEGIN HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] END HANDLER MESSAGES
[Thu Nov  6 09:56:07 2008] action exited with status 0
[Thu Nov  6 09:56:07 2008] completed event "battery BAT0 00000080 00000001"

Last edited by rssn6; 11-06-2008 at 09:01 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bypassing ACPI lid button event in X Erratio Linux - Laptop and Netbook 3 10-13-2008 12:12 PM
Lid Off/On with ACPI alkos333 Slackware 10 05-28-2007 10:26 PM
ACPI Lid Question brokenflea Slackware 1 12-31-2005 04:09 AM
Inspiron 8500 LID switch with ACPI RBJohns Linux - Laptop and Netbook 8 05-21-2005 10:17 AM
lid close generates no acpi event mannyzen76 Linux - Laptop and Netbook 0 02-21-2004 11:37 PM


All times are GMT -5. The time now is 06:45 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration