On Tue, 2007-01-02 at 01:27 -0600, »Q« wrote:
> 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

It could be a number of things - perhaps you have a faulty cable /
connection, which is causing ACPI events because it thinks it's just
been unplugged, and replugged.

Or perhaps your thinkpad sends ACPI events when the battery has reached
certain charge levels... don't know - someone with the same laptop will
have to comment.

Do these spontaneous ACPI events only happen when plugged in? or only
when unplugged, or both?

To get around it, perhaps you could keep "state" with a file.  eg
(untested):

-----
BRIGHTNESS_AC="4"
BRIGHTNESS_BATTERY="1"
ALREADY_PLUGGED_IN="/.power"

if on_ac_power
then
    if -f ${ALREADY_PLUGGED_IN} then
        logger "Recieved ACPI power event, but already plugged in!"
    else
        logger "Setting LCD to brightness ${BRIGHTNESS_AC}"
        echo $BRIGHTNESS_AC > /proc/acpi/sony/brightness
        touch ${ALREADY_PLUGGED_IN}
    fi
else
    logger "Setting LCD to brightness ${BRIGHTNESS_BATTERY}"
    echo $BRIGHTNESS_BATTERY > /proc/acpi/sony/brightness
    rm ${ALREADY_PLUGGED_IN}
fi
-----

This will only work for the already-plugged-in-acpi-event, you may have
to do a bit of playing if you also get an already-unplugged-acpi-event,
but I have to leave some fun for you!

HTH!
-- 
Iain Buchanan <iaindb at netspace dot net dot au>

It is better to have loved and lost -- much better.

-- 
gentoo-user@gentoo.org mailing list

Reply via email to