tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: problems with sysmon power



On Mon, Mar 10, 2008 at 03:20:17PM +0100, Matthias Drochner wrote:
> envstat reports the correct state, and does react rather quickly.
> But a printf in sme_acadapter_check() shows that the "value_cur"
> inside the kernel is not updated until either the state changes
> (if I unplug/replug the power supply), or "envstat" is invoked.

Wait a moment. If you do a boot -s and plug/unplug the AC you don't get
a kernel message about that?

> The battery state check didn't work because it accesses uninitialized
> variables of empty battery slots, and because the logics in
> sme_battery_check() is generally flawed.

The logic is working for a two battery Thinkpad, so it can't be that
flawed. That does include empty slots. Can you be more specific of what
you are seeing? The empty slots should actually not be exposed to the
kernel at all, they are an implementation detail of the ACPI code.

> (I wonder whether the ENVSYS_SVALID flag
> should be checked everywhere, but it seems that it isn't maintained
> consistently within the framework.)

I would prefer if everything would use the flag consistently and I once
had a patch to do that for acpibat, but I dropped that after I fixed the
real issues.

> Note that also the sme_acadapter_check() won't work correctly
> if more than one adapter is configured - it does't even pretend to
> test a second one. (And there is a slight abstraction violation -
> use of the loop variable after TAILQ_FOREACH().)

I wouldn't be surprised, I think the logic is currently inverted (drop
out if one AC is connected with true vs. drop out of one AC is
disconnected).

Joerg


Home | Main Index | Thread Index | Old Index