[patch] Move negative checks to util.c, from acpi.c (resend)

Danny Kukawka danny.kukawka at web.de
Sun Aug 21 11:44:39 PDT 2005


On Sunday 21 August 2005 20:18, Richard Hughes wrote:
> On Sun, 2005-08-21 at 20:03 +0200, Danny Kukawka wrote:
> > The else path is IMO alway true if the machine is full charged and on AC.
> > In this case we don't need the remaining time. Also not as 0, I think.
> > This maybe can also happen in other case (I don't know a machine with
> > this problem currently.) But in this case you have more than only a broke
> > ACPI Implementation. And in this case you don't need the 0. ;-)
>
> Okay, good points. What about the following?

Looks good for me with one change:


> +       if (chargeRate == 0) {
> +               /* Some ACPI BIOS's don't report rate */
> +               if (isDischarging || isCharging)
> +                       HAL_WARNING (("chargeRate is 0, but discharging or 
charging. ACPI bug?."));
> +               else
> +                       HAL_INFO (("chargeRate is 0"));
> 

I think it should be:

HAL_INFO (("chargeRate is 0 (or unknown)"));

The reason: the chargeRate is normally only 0 if the related entry 
in /proc/acpi/battery/*/state (present rate:) is unknown. 

[ This is IMO on more case (I implemted this also in one of my older patches 
and can add it also again) where we maybe should not provide the key. But 
this (not to provide keys where the entry in /proc/acpi/battery/*/* is 
'unknown') is more generally than the other things. ;-) ]

Cheers,

Danny

ps: dont't forget to commit the Changelog ;-)


More information about the hal mailing list