[patch] Move negative checks to util.c, from acpi.c (resend)
Danny Kukawka
danny.kukawka at web.de
Wed Aug 17 15:32:44 PDT 2005
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.
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?
Cheers,
Danny
More information about the hal
mailing list