# /etc/acpi/default.sh not being called? [SOLVED]

## mikegpitt

I just realised I'm having a problem with acpi.  It seems that /etc/acpi/default.sh isn't being called on events.  I'm not sure when this started happening, since suspend was broken on my laptop until recently, but I did just update to the 2.6.30 kernel in the last week or so.

When I run acpi_listen, events are being reported, so I know acpid seems to be working, but none of the commands I have placed in /etc/acpi/default.sh are being run.

Here is my default.sh file (unchanged since it was working a while back):

```
# ls -l /etc/acpi/default.sh 

-rwxr-xr-x 1 root root 1514 Aug 10 10:45 /etc/acpi/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() {

        #turning off logging

        #logger "ACPI event unhandled: $*"

}

case "$group" in

        button)

                case "$action" in

                        power)

                                /sbin/init 0

                                ;;

                        lid)

                                /usr/sbin/hibernate-ram

                                ;;

                        # 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

                ;;

        #video)

        #

        #       /usr/bin/vga-clone.sh

        #       ;;

        ac_adapter)

                case "$value" in

                        # Add code here to handle when the system is unplugged

                        # (maybe change cpu scaling to powersave mode).  For

                        # multicore systems, make sure you set powersave mode

                        # for each core!

                        *0)

                                # dim display to level 56

                                echo 56 | sudo dd of=/proc/acpi/video/VGA/LCD/brightness

                        #       cpufreq-set -g powersave

                                ;;

                        # Add code here to handle when the system is plugged in

                        # (maybe change cpu scaling to performance mode).  For

                        # multicore systems, make sure you set performance mode

                        # for each core!

                        *1)

                                # raise brightness to 100

                                echo 100 | sudo dd of=/proc/acpi/video/VGA/LCD/brightness

                        #       cpufreq-set -g performance

                                ;;

                        *)      log_unhandled $* ;;

                esac

                ;;

        *)      log_unhandled $* ;;

esac

```

...and my /etc/acpi/events/default:

```
event=.*

action=/etc/acpi/default.sh %e

```

Last edited by mikegpitt on Tue Aug 11, 2009 3:50 am; edited 1 time in total

----------

## erik258

and acpid is running, right?

----------

## mikegpitt

 *erik258 wrote:*   

> and acpid is running, right?

 Yep   :Smile: 

----------

## erik258

Darn.  That would have been an easy one : )

 *Quote:*   

> When I run acpi_listen, events are being reported

 

But are they events with an action in default.sh?  In other words, do you have button, lid, & so on in the kernel, or modules loaded?  Some ideas from my /proc/config.gz:

```
CONFIG_ACPI=y

CONFIG_ACPI_BUTTON=y

# CONFIG_ACPI_AC is not set

# CONFIG_ACPI_BATTERY is not set

# CONFIG_ACPI_VIDEO is not set

CONFIG_ACPI_FAN=y

CONFIG_ACPI_DOCK=y

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_THERMAL=y
```

----------

## mikegpitt

 *erik258 wrote:*   

> Darn.  That would have been an easy one : )

 

Heh, I always get stuck with the hard problems   :Laughing: 

My kernel seems fine.  Those options are compiled as modules, and are loaded:

```
CONFIG_ACPI=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_PROCFS=y

CONFIG_ACPI_PROCFS_POWER=y

CONFIG_ACPI_SYSFS_POWER=y

CONFIG_ACPI_PROC_EVENT=y

CONFIG_ACPI_AC=m

CONFIG_ACPI_BATTERY=m

CONFIG_ACPI_BUTTON=m

CONFIG_ACPI_VIDEO=m

CONFIG_ACPI_FAN=m

CONFIG_ACPI_DOCK=y

CONFIG_ACPI_PROCESSOR=m

CONFIG_ACPI_HOTPLUG_CPU=y

CONFIG_ACPI_THERMAL=m

```

```
$ lsmod 

Module                  Size  Used by

usb_storage            50080  0 

i915                  153240  2 

drm                   145204  3 i915

i2c_algo_bit            5368  1 i915

ac                      4212  0 

ipv6                  221944  14 

cpufreq_ondemand        7096  0 

acpi_cpufreq            7712  0 

freq_table              4280  2 cpufreq_ondemand,acpi_cpufreq

arc4                    1672  2 

ecb                     2684  2 

iwl3945                70684  0 

iwlcore                96984  1 iwl3945

firmware_class          7456  1 iwl3945

mac80211              131624  2 iwl3945,iwlcore

led_class               4196  2 iwl3945,iwlcore

ehci_hcd               31564  0 

uhci_hcd               20152  0 

video                  19704  1 i915

rtc                     6764  0 

backlight               4296  1 video

r8169                  30004  0 

usbcore               128104  4 usb_storage,ehci_hcd,uhci_hcd

i2c_i801                8000  0 

cfg80211               60340  3 iwl3945,iwlcore,mac80211

output                  2740  1 video

sg                     26020  0 

processor              36240  1 acpi_cpufreq

mii                     4960  1 r8169

thermal                13696  0 

battery                10876  0 

button                  5452  0 

i2c_core               22652  4 i915,drm,i2c_algo_bit,i2c_i801

```

I thought the same as you about the options not being hit properly in default.sh, so i decided to put a generic echo to file line outside the case statement, and nothing happened.  I'm a bit puzzled by it...

----------

## mikegpitt

Solved it...  It turned out when I commented out the log_unhandled() lines, it caused the script to bomb out.  Adding an echo "" to that function fixed things.

```

log_unhandled() {

        #turning off logging

        #logger "ACPI event unhandled: $*"

        echo ""

}

```

----------

