[patch] Move negative checks to util.c, from acpi.c (resend)
David Zeuthen
david at fubar.dk
Wed Aug 17 18:36:03 PDT 2005
On Thu, 2005-08-18 at 00:32 +0200, Danny Kukawka wrote:
> On Wednesday 17 August 2005 23:56, Richard Hughes wrote:
> > Moves the negative checks to util.c so that pmu (and soon to be apm) can
> > use the same logic.
> >
> > Okay to commit?
>
> Looks good, I can't see any problems with this patch at the first look.
Looks OK to me too..
> Something other I already discussed with David and which maybe effect yout
> patch:
>
> I would prefer to set the remainig time and percentage to -1 if there is any
> error during calculation to know if the battery is really empty or if there
> was a error. With the current behavior we can't differ between this two
> cases.
>
> A case to explain:
> - a error during calculation (e.g. one value is unknow
> in /proc/acpi/battery/*) and the calculation of remainig time/percentage
> fails.
> - HAL set remainig time/percentage to 0
> - you have a rule in your powermanagement program (e.g. powersave or
> g-p-m ) "shutdown if remainig time == 0"
>
> In this case you shutdown maybe the system already if the battery is full. But
> if you get -1 as returnvalue you can control other values to get more fuzzy
> information about remainig time/percentage or pop-up a dialog to inform the
> user about this error.
>
> Any ideas?
You raise some good points..
Actually, I'd rather we set the percentage to 100% and remaining time to
some high number too (either a number made up or derived from design
capacity etc.) in order to let e.g. gnome-power-manager et. al. not do
any crazy actions like shutting down..
I'm not sure we want -1 because that will make it more difficult to
implement gnome-power-manager et. al. and, really, the main point is
that the bug with ACPI is something that should be fixed.. In other
words, I don't think we should design for broken hardware... I'm not
super religious about this - what does other people think?
Cheers,
David
More information about the hal
mailing list