[Pm-utils] on_ac_power is broken
Peter Jones
pjones at redhat.com
Tue Dec 5 08:35:22 PST 2006
On Mon, 2006-12-04 at 10:22 +0100, Stefan Seyfried wrote:
> The problem is, that on a desktop, there can be no AC adapter (the power
> supply is not exposed via ACPI for example), but a battery, for example
> the battery in the wireless mouse :-)
Gah! OK, I guess this is true.
> Instead of checking for the exact battery type and add even more dbus calls
> to HAL with all their overhead, i decided to just skip the battery test:
>
> - if there are no AC adapters at all:
> => assume "on AC power", since this is probably a desktop.
> exit 0
> - check all ac adapters:
> - if any is "online", => exit 0, "on AC power"
> - exit 1, no ac adapter was online => on battery.
Sounds good.
> The only thing i can remember where i could be wrong here is if there are
> machines where the AC adapter "appears" once you plug it in, and disappears
> once you unplug it. I have not yet seen such a machine yet (both ACPI and
> APM always have the adapter, but it is either "online" or "offline").
Let's deal with that if we see it.
Patch applied. I changed some of the comments, as well as the NOTE at
the top of the file.
--
Peter
More information about the Pm-utils
mailing list