LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Reply
 
Search this Thread
Old 11-07-2006, 06:55 PM   #1
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Rep: Reputation: 30
What governs the power button behaviour?


Specifically I find that my power button kicks off a shutdown. From X or whatever the machine simply goes immediately into a shutdown.

I am running acpid and Gnome 2.16 which I have set the power manager configuration to "Ask Me" what to do when the power button is pressed.

I am not sure if it is a default rule in acpid or X that is taking effect because the Ask Me feature certainly is not.

Code:
stardotstar@spitfire /etc/acpi/events $ ls 
a-ac-aticonfig   default        lm_battery  pmg_ac_adapter
a-lid-aticonfig  lm_ac_adapter  lm_lid      pmg_battery
so no event identified (default is not changed)

Code:
stardotstar@spitfire /etc/acpi $ cd actions/
stardotstar@spitfire /etc/acpi/actions $ ls
lm_ac_adapter.sh  lm_battery.sh  lm_lid.sh  pmg_switch_runlevel.sh
no power button action defined either...

Any pointers?

TIA
 
Old 11-07-2006, 08:30 PM   #2
hockeyman_102
Member
 
Registered: Apr 2006
Location: Washington
Distribution: Suse, CentOS, Ubuntu
Posts: 124

Rep: Reputation: 15
check your bios. I've seen in in a few.
 
Old 11-09-2006, 09:32 PM   #3
dosnlinux
Member
 
Registered: Mar 2005
Distribution: slackware 11, arch 2007.08
Posts: 154

Rep: Reputation: 30
The stuff in /etc/acpi/acpi_handler.sh controls what the power button does.

The line in the file will look something like this:
Code:
case "$1" in
  button)
    case "$2" in
      power) if [ -f /var/run/s3 ]
                 then rm -f /var/run/s3
                 else /sbin/init 0
             fi
         ;;
Just change the stuff after "power)" to tell your computer what to do when the button is pressed.
 
Old 11-10-2006, 07:32 PM   #4
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
Thank you for that I will check it later today...

As for the BIOS - this is a MacBook Pro so it is EFI and the issues around bios are complicated - the video drivers need a legacy bios emulation and that is provided but lots of progs that rely on legacy bios simply dont' work - memtest86 for instance.


Will
 
Old 11-12-2006, 03:45 PM   #5
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
No script as such:

Code:
stardotstar@spitfire ~ $ sudo find / -iname "acpi_handler.sh"
find: /mnt/osx/Library/Documentation/Applications/GarageBand/GarageBand Getting Started.app/Contents/Resources/ko.lproj/GarageBand ������������.pdf: No such file or directory
find: /mnt/osx/Library/Documentation/Applications/iDVD/iDVD Getting Started.app/Contents/Resources/ko.lproj/iDVD ������������.pdf: No such file or directory
find: /mnt/osx/Library/Documentation/Applications/iMovie/iMovie Getting Started.app/Contents/Resources/ko.lproj/iMovie HD ������������.pdf: No such file or directory
stardotstar@spitfire ~ $
 
Old 11-15-2006, 11:03 PM   #6
Tyante
LQ Newbie
 
Registered: Oct 2004
Location: California
Distribution: Slackware, Debian, FreeBSD
Posts: 10

Rep: Reputation: 0
Look inside your /etc/acpi/ directory. Check for any scripts or for a folder possibly called events. One mine, there is a /etc/acpi/events/default file that runs the script /etc/acpi/acpi_handler.sh

If there is an /etc/acpi/events folder look through the files and see if any contain the /sbin/init 0
 
Old 11-15-2006, 11:09 PM   #7
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
Yep, there it is:

Code:
spitfire acpi # cat default.sh 
#!/bin/sh
# /etc/acpi/default.sh
# Default acpi script that takes an entry for all actions

set $*

group=${1/\/*/}
action=${1/*\//}
device=$2
id=$3
value=$4

log_unhandled() {
        logger "ACPI event unhandled: $*"
}

case "$group" in
        button)
                case "$action" in
                        power)
                                /sbin/init 0
                                ;;

                        # if your laptop doesnt turn on/off the display via hardware
                        # switch and instead just generates an acpi event, you can force
                        # X to turn off the display via dpms.  note you will have to run
                        # 'xhost +local:0' so root can access the X DISPLAY.
                        lid)
                                xset dpms force off
                                ;;

                        *)      log_unhandled $* ;;
                esac
                ;;

        ac_adapter)
                case "$value" in
                        # Add code here to handle when the system is unplugged
                        # (maybe change cpu scaling to powersave mode)
                        #*0)
                        #       ;;

                        # Add code here to handle when the system is plugged in
                        # (maybe change cpu scaling to performance mode)
                        #*1)
                        #       ;;

                        *)      log_unhandled $* ;;
                esac
                ;;

        *)      log_unhandled $* ;;
esac
so I can disable that behaviour there? and then map it to some other action as well - like hibernate...
 
Old 11-16-2006, 06:44 PM   #8
dosnlinux
Member
 
Registered: Mar 2005
Distribution: slackware 11, arch 2007.08
Posts: 154

Rep: Reputation: 30
You should be able to.
 
Old 11-18-2006, 03:28 AM   #9
Tyante
LQ Newbie
 
Registered: Oct 2004
Location: California
Distribution: Slackware, Debian, FreeBSD
Posts: 10

Rep: Reputation: 0
Quote:
Originally Posted by stardotstar
so I can disable that behaviour there? and then map it to some other action as well - like hibernate...
You can just disable it by commenting it out or deleting the line. Just add whatever command or script you want to run. You can run multiple commands. Put them each on their own line. It will run everything up till it hits the ";;" line. You can also add sleep button commands if your laptop has a sleep button and it is recognized.
 
  


Reply

Tags
acpid, power


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Power-Off with Button? win32sux Linux - Hardware 6 07-01-2006 02:19 PM
Middle mouse button behaviour tomservo291 Linux - Software 0 02-17-2005 08:01 AM
Power Button for Shutdown gokul Linux - Hardware 4 01-24-2004 01:40 PM
Needs to push power button to power off? danpin Linux - Newbie 5 10-21-2003 09:08 PM
Filthy linmodem behaviour & panic button query Bert General 3 01-31-2002 07:00 AM


All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
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 Google+: linuxquestions
Open Source Consulting | Domain Registration