public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user]  acpi battery events, Sony FS740
@ 2007-01-02  7:27 »Q«
  2007-01-03  1:42 ` Iain Buchanan
  0 siblings, 1 reply; 4+ messages in thread
From: »Q« @ 2007-01-02  7:27 UTC (permalink / raw
  To: gentoo-user

I'm nearly a complete newbie to power management.  I've been reading
and tinkering for the past three days.  I'm not sure I know enough to
explain my problem clearly, but I'll be glad to try to clarify or post
more info if you can steer me a bit.

I have a Sony Vaio FS740 laptop, and I have power management set up
mostly to my liking, but with one problem.  ACPI receives battery
events when the AC is connect and when it is unconnected, but also at
other times, and I don't know how to distinguish.  If there are no
actions for acpid to take when they happen, the
script /etc/acpi/default.sh sends this to the syslog:

logger: ACPI event unhandled: battery BAT0 00000080 00000001
logger: ACPI event unhandled: battery BAT0 00000080 00000001

They come in pairs, and the string is the same whether the cord has
just been attached or removed or neither.

I have an acpid event/action which catches these and then sets the
brightness level depending on whether or not the cord is plugged in.
This works fine when I switch between AC and battery power.  The
problem is that if I want to set some other brightness level manually,
it does no good, because one of the I-don't-know-why-they-happen
battery events will trigger a change in brightness within a couple of
minutes.

Here's the event file for acpid, /etc/acpi/events/pmg_brightness :

-----
event=battery.*
action=/etc/acpi/actions/pmg_change_brightness.sh %e
-----


And here's /etc/acpi/actions/pmg_change_brightness.sh :

-----
#!/bin/bash

# this line was added in hopes of debugging,
# but I see no help from it.
logger "brightness script caught: ${*}"

BRIGHTNESS_AC="4"
BRIGHTNESS_BATTERY="1"

if on_ac_power
then
    logger "Setting LCD to brightness ${BRIGHTNESS_AC}"
    echo $BRIGHTNESS_AC > /proc/acpi/sony/brightness
else
    logger "Setting LCD to brightness ${BRIGHTNESS_BATTERY}"
    echo $BRIGHTNESS_BATTERY > /proc/acpi/sony/brightness
fi
-----

Whether it's triggered by unplugging or by I-don't-know-what, I get
this in the syslog: 

  logger: brightness script caught: battery BAT0 00000080 00000001
  logger: Setting LCD to brightness 1

Same thing for plugging in or I-don't-know-what, except the brightness
is set to 4 as expected.

I'd appreciate any insight or help you can give me.

-- 
»Q«

--
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-04  2:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-02  7:27 [gentoo-user] acpi battery events, Sony FS740 »Q«
2007-01-03  1:42 ` Iain Buchanan
2007-01-04  1:46   ` [gentoo-user] " »Q«
2007-01-04  2:16     ` Iain Buchanan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox