You are not logged in.

#1 2010-10-01 19:39:24

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

shutdown computer by pressing power button [SOLVED]

hi there,

I used to be able to shutdown my computer by pressing the power button. It was configured using the first method described in the wiki. This was about one year ago or so.

It hasn't been working for several months. I tried the second method, but it's not working either.

This computer runs LXDE (in case this is relevant). acpid and hal start properly.

Any hint or workaround would be welcome,

thanks.

Last edited by brazzmonkey (2010-10-05 07:26:04)


what goes up must come down

Offline

#2 2010-10-03 22:24:26

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: shutdown computer by pressing power button [SOLVED]

brazzmonkey wrote:

hi there,

I used to be able to shutdown my computer by pressing the power button. It was configured using the first method described in the wiki. This was about one year ago or so.

It hasn't been working for several months. I tried the second method, but it's not working either.

This computer runs LXDE (in case this is relevant). acpid and hal start properly.

Any hint or workaround would be welcome,

thanks.

This is handled by acpid that by default call /etc/acpi/events/* (in archlinux there is only one file "anything" that call /etc/acpi/handler.sh with the proper argument. In my case I have made the following change to /etc/acpi/handler.sh

#!/bin/sh
# Default acpi script that takes an entry for all actions

# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
    button/power)
        #echo "PowerButton pressed!">/dev/tty5
        case "$2" in
            PWRF)   logger "PowerButton pressed: $2"
                /sbin/poweroff # Ajout
                ;;
            *)      logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB)   /usr/sbin/pm-suspend ;;
            *)      logger "ACPI action undefined: $2" ;;
        esac
        ;;
    ac_adapter)
        case "$2" in
            AC)
                case "$4" in
                    00000000)
                        # echo -n $minspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode start
                    ;;
                    00000001)
                        # echo -n $maxspeed >$setspeed
                        #/etc/laptop-mode/laptop-mode stop
                    ;;
                esac
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    battery)
        case "$2" in
            BAT0)
                case "$4" in
                    00000000)   #echo "offline" >/dev/tty5
                    ;;
                    00000001)   #echo "online"  >/dev/tty5
                    ;;
                esac
                ;;
            CPU0)    
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/lid)
        #echo "LID switched!">/dev/tty5
        ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

In order to debug the situation you might want to kill acpid and

cat /proc/acpi/event

then press the power button to see what acpid pass to handler.sh

Offline

#3 2010-10-03 22:31:42

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: shutdown computer by pressing power button [SOLVED]

My power button generates an X11 key: XF86PowerOff (check with xev)

If you get a similar key event, you could bind something to it like sudo halt in xbindkeys.

Offline

#4 2010-10-04 08:08:28

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: shutdown computer by pressing power button [SOLVED]

thanks for you assistance.

@olive
my /etc/acpi/handler.sh already looks like yours, because it's the second method described in the wiki. It doesn't work.
I killed acpid, cat /proc/acpi/event, and pressed the power button, but I got no output.

@Procyon
xev is nowhere to be found?


what goes up must come down

Offline

#5 2010-10-04 09:22:24

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: shutdown computer by pressing power button [SOLVED]

xev is part of the xorg-utils package (from extra).


To know or not to know ...
... the questions remain forever.

Offline

#6 2010-10-04 09:56:35

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: shutdown computer by pressing power button [SOLVED]

thanks for pointing.
xev doesn't detect anything when I press power button. I suppose this is no software issue, then.
I guess I have to get my hands on a ps2 keyboard and check my BIOS...


what goes up must come down

Offline

#7 2010-10-04 14:40:11

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: shutdown computer by pressing power button [SOLVED]

brazzmonkey wrote:

thanks for you assistance.

@olive
my /etc/acpi/handler.sh already looks like yours, because it's the second method described in the wiki. It doesn't work.
I killed acpid, cat /proc/acpi/event, and pressed the power button, but I got no output.

Have you loaded the needed modules. I think that the module "button" must be loaded (In my case all is loaded automatically). I put the output of my lsmod so that you see what modules I have:

Module                  Size  Used by
snd_hda_codec_realtek   193812  1 
usbhid                 33564  0 
hid                    60400  1 usbhid
snd_hda_codec_si3054     3106  1 
snd_hda_intel          19020  0 
snd_seq_dummy           1079  0 
snd_seq_oss            25072  0 
snd_seq_midi_event      4496  1 snd_seq_oss
uhci_hcd               19251  0 
i915                  267072  2 
snd_hda_codec          67274  3 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_intel
snd_seq                41752  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
joydev                  7503  0 
8139too                18001  0 
ehci_hcd               32860  0 
8139cp                 15868  0 
snd_seq_device          4369  3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss            33662  0 
snd_mixer_oss          14686  1 snd_pcm_oss
snd_hwdep               4764  1 snd_hda_codec
drm_kms_helper         22043  1 i915
drm                   134132  3 i915,drm_kms_helper
led_class               1843  0 
i2c_algo_bit            4407  1 i915
iTCO_wdt                8677  0 
snd_pcm                58308  4 snd_hda_codec_si3054,snd_hda_intel,snd_hda_codec,snd_pcm_oss
snd_timer              15423  2 snd_seq,snd_pcm
i2c_i801                7426  0 
intel_agp              24510  2 i915
mii                     3198  2 8139too,8139cp
usbcore               121737  4 usbhid,uhci_hcd,ehci_hcd
iTCO_vendor_support     1433  1 iTCO_wdt
snd                    43283  12 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_intel,snd_seq_oss,snd_hda_codec,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_hwdep,snd_pcm,snd_timer
ac                      2329  0 
battery                 7879  0 
video                  15889  1 i915
i2c_core               15599  5 i915,drm_kms_helper,drm,i2c_algo_bit,i2c_i801
psmouse                51529  0 
sg                     20932  0 
soundcore               5025  1 snd
thermal                 9786  0 
processor              25126  1 
evdev                   6820  1 
serio_raw               3566  0 
output                  1448  1 video
button                  3746  1 i915
snd_page_alloc          5981  2 snd_hda_intel,snd_pcm
agpgart                23520  2 drm,intel_agp
rtc_cmos                7746  0 
rtc_core               11831  1 rtc_cmos
rtc_lib                 1494  1 rtc_core
ext3                  110740  1 
jbd                    39247  1 ext3
mbcache                 4290  1 ext3
sd_mod                 26768  3 
sr_mod                 13313  0 
cdrom                  31410  1 sr_mod
pata_acpi               2308  0 
ata_piix               18128  2 
ahci                   17813  0 
libahci                16174  1 ahci
libata                140771  4 pata_acpi,ata_piix,ahci,libahci
scsi_mod              105888  4 sg,sr_mod,sd_mod,libata

Offline

#8 2010-10-05 07:25:15

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: shutdown computer by pressing power button [SOLVED]

olive, you got that one right! Thanks a lot for your help!

I'll update the wiki.

Cheers.


what goes up must come down

Offline

Board footer

Powered by FluxBB