1 |
On Friday 16 February 2007 19:13, Raymond Lewis Rebbeck wrote: |
2 |
> On Saturday, 17 February 2007 5:31, Mick wrote: |
3 |
> > Hi All, |
4 |
> > |
5 |
> > A few weeks ago I updated acpi and hibernate and their relevant |
6 |
> > configuration files. Since then when I press the power button on my |
7 |
> > laptop nothing happens. |
8 |
> > |
9 |
> > Clearly something was changed, intentionally or otherwise, and this |
10 |
> > feature is no longer available to me. Would you care to point me in the |
11 |
> > right direction - how do I set my power button to run the hibernate |
12 |
> > script? |
13 |
> |
14 |
> I assume you're using acpid. Look in /etc/acpi/ there is a default script |
15 |
> that is run for acpi events, it handles the power button by calling |
16 |
> /sbin/init 0. Replace the command it runs with hibernate or similar. |
17 |
|
18 |
Thanks Raymond, I have this in my /etc/acpi/events/default: |
19 |
========================== |
20 |
event=button[/]power.* |
21 |
action=/usr/sbin/hibernate |
22 |
========================== |
23 |
|
24 |
but nothing happens or gets logged when I press the power button. Could this |
25 |
be something to do with the /etc/acpi/default.sh file perhaps? I vaguely |
26 |
remember hacking it unashamedly in the mist of time to get the button |
27 |
working. |
28 |
========================== |
29 |
#!/bin/sh |
30 |
# /etc/acpi/default.sh |
31 |
# Default acpi script that takes an entry for all actions |
32 |
|
33 |
set $* |
34 |
|
35 |
group=${1/\/*/} |
36 |
action=${1/*\//} |
37 |
device=$2 |
38 |
id=$3 |
39 |
value=$4 |
40 |
|
41 |
log_unhandled() { |
42 |
logger "ACPI event unhandled: |
43 |
$*" } |
44 |
|
45 |
case "$group" in |
46 |
button) |
47 |
case "$action" in |
48 |
power) |
49 |
/sbin/init 0 |
50 |
;; |
51 |
sleep) |
52 |
/usr/sbin/hibernate |
53 |
;; |
54 |
thermal_zone) |
55 |
;; # I don't care, the fan works anyway. |
56 |
|
57 |
# if your laptop doesnt turn on/off the display via hardware |
58 |
# switch and instead just generates an acpi event, you can force |
59 |
# X to turn off the display via dpms. note you will have to run |
60 |
# 'xhost +local:0' so root can access the X DISPLAY. |
61 |
#lid) |
62 |
xset dpms force off |
63 |
# ;; |
64 |
|
65 |
*) log_unhandled $* ;; |
66 |
esac |
67 |
;; |
68 |
|
69 |
ac_adapter) |
70 |
case "$value" in |
71 |
# Add code here to handle when the system is unplugged |
72 |
# (maybe change cpu scaling to powersave mode) |
73 |
#*0) |
74 |
# ;; |
75 |
|
76 |
# Add code here to handle when the system is plugged |
77 |
in |
78 |
# (maybe change cpu scaling to performance mode) |
79 |
#*1) |
80 |
# ;; |
81 |
*) log_unhandled $* ;; |
82 |
esac |
83 |
========================== |
84 |
|
85 |
Can you spot anything out of place? |
86 |
-- |
87 |
Regards, |
88 |
Mick |