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«

--
[email protected] mailing list

Reply via email to