1 |
On Tue, 2007-01-02 at 01:27 -0600, »Q« wrote: |
2 |
> I'm nearly a complete newbie to power management. I've been reading |
3 |
> and tinkering for the past three days. I'm not sure I know enough to |
4 |
> explain my problem clearly, but I'll be glad to try to clarify or post |
5 |
> more info if you can steer me a bit. |
6 |
> |
7 |
> I have a Sony Vaio FS740 laptop, and I have power management set up |
8 |
> mostly to my liking, but with one problem. ACPI receives battery |
9 |
> events when the AC is connect and when it is unconnected, but also at |
10 |
> other times, and I don't know how to distinguish. If there are no |
11 |
> actions for acpid to take when they happen, the |
12 |
> script /etc/acpi/default.sh sends this to the syslog: |
13 |
> |
14 |
> logger: ACPI event unhandled: battery BAT0 00000080 00000001 |
15 |
> logger: ACPI event unhandled: battery BAT0 00000080 00000001 |
16 |
|
17 |
It could be a number of things - perhaps you have a faulty cable / |
18 |
connection, which is causing ACPI events because it thinks it's just |
19 |
been unplugged, and replugged. |
20 |
|
21 |
Or perhaps your thinkpad sends ACPI events when the battery has reached |
22 |
certain charge levels... don't know - someone with the same laptop will |
23 |
have to comment. |
24 |
|
25 |
Do these spontaneous ACPI events only happen when plugged in? or only |
26 |
when unplugged, or both? |
27 |
|
28 |
To get around it, perhaps you could keep "state" with a file. eg |
29 |
(untested): |
30 |
|
31 |
----- |
32 |
BRIGHTNESS_AC="4" |
33 |
BRIGHTNESS_BATTERY="1" |
34 |
ALREADY_PLUGGED_IN="/.power" |
35 |
|
36 |
if on_ac_power |
37 |
then |
38 |
if -f ${ALREADY_PLUGGED_IN} then |
39 |
logger "Recieved ACPI power event, but already plugged in!" |
40 |
else |
41 |
logger "Setting LCD to brightness ${BRIGHTNESS_AC}" |
42 |
echo $BRIGHTNESS_AC > /proc/acpi/sony/brightness |
43 |
touch ${ALREADY_PLUGGED_IN} |
44 |
fi |
45 |
else |
46 |
logger "Setting LCD to brightness ${BRIGHTNESS_BATTERY}" |
47 |
echo $BRIGHTNESS_BATTERY > /proc/acpi/sony/brightness |
48 |
rm ${ALREADY_PLUGGED_IN} |
49 |
fi |
50 |
----- |
51 |
|
52 |
This will only work for the already-plugged-in-acpi-event, you may have |
53 |
to do a bit of playing if you also get an already-unplugged-acpi-event, |
54 |
but I have to leave some fun for you! |
55 |
|
56 |
HTH! |
57 |
-- |
58 |
Iain Buchanan <iaindb at netspace dot net dot au> |
59 |
|
60 |
It is better to have loved and lost -- much better. |
61 |
|
62 |
-- |
63 |
gentoo-user@g.o mailing list |