Gentoo Archives: gentoo-user

From: "»Q«" <boxcars@×××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] acpi battery events, Sony FS740
Date: Tue, 02 Jan 2007 07:35:20
Message-Id: 20070102012710.4c49f6bb@goldry.remarqs
1 I'm nearly a complete newbie to power management. I've been reading
2 and tinkering for the past three days. I'm not sure I know enough to
3 explain my problem clearly, but I'll be glad to try to clarify or post
4 more info if you can steer me a bit.
5
6 I have a Sony Vaio FS740 laptop, and I have power management set up
7 mostly to my liking, but with one problem. ACPI receives battery
8 events when the AC is connect and when it is unconnected, but also at
9 other times, and I don't know how to distinguish. If there are no
10 actions for acpid to take when they happen, the
11 script /etc/acpi/default.sh sends this to the syslog:
12
13 logger: ACPI event unhandled: battery BAT0 00000080 00000001
14 logger: ACPI event unhandled: battery BAT0 00000080 00000001
15
16 They come in pairs, and the string is the same whether the cord has
17 just been attached or removed or neither.
18
19 I have an acpid event/action which catches these and then sets the
20 brightness level depending on whether or not the cord is plugged in.
21 This works fine when I switch between AC and battery power. The
22 problem is that if I want to set some other brightness level manually,
23 it does no good, because one of the I-don't-know-why-they-happen
24 battery events will trigger a change in brightness within a couple of
25 minutes.
26
27 Here's the event file for acpid, /etc/acpi/events/pmg_brightness :
28
29 -----
30 event=battery.*
31 action=/etc/acpi/actions/pmg_change_brightness.sh %e
32 -----
33
34
35 And here's /etc/acpi/actions/pmg_change_brightness.sh :
36
37 -----
38 #!/bin/bash
39
40 # this line was added in hopes of debugging,
41 # but I see no help from it.
42 logger "brightness script caught: ${*}"
43
44 BRIGHTNESS_AC="4"
45 BRIGHTNESS_BATTERY="1"
46
47 if on_ac_power
48 then
49 logger "Setting LCD to brightness ${BRIGHTNESS_AC}"
50 echo $BRIGHTNESS_AC > /proc/acpi/sony/brightness
51 else
52 logger "Setting LCD to brightness ${BRIGHTNESS_BATTERY}"
53 echo $BRIGHTNESS_BATTERY > /proc/acpi/sony/brightness
54 fi
55 -----
56
57 Whether it's triggered by unplugging or by I-don't-know-what, I get
58 this in the syslog:
59
60 logger: brightness script caught: battery BAT0 00000080 00000001
61 logger: Setting LCD to brightness 1
62
63 Same thing for plugging in or I-don't-know-what, except the brightness
64 is set to 4 as expected.
65
66 I'd appreciate any insight or help you can give me.
67
68 --
69 »Q«
70
71 --
72 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] acpi battery events, Sony FS740 Iain Buchanan <iaindb@××××××××××××.au>