[PATCH] fix compute remaining percentage and time on broken ACPI implementations

Danny Kukawka danny.kukawka at web.de
Wed Aug 10 12:42:44 PDT 2005


Hi,

this is a patch to fix compute remaining percentage and remaining time on 
broken ACPI implementations (e.g. with unknown present rate). This patch 
prevents negative normalised values. The fix base on my other ACPI patches.

- Changes in util_compute_percentage_charge()/util_compute_time_remaining(): 
  * return -1 instead of 0 if an error occurs to differentiate between an 
	 error and an empty battery.
  * removed unneeded warning message if calculated "percentage < 0"
  * return -1 if parameter chargeRate, chargeLevel or chargeLastFull are	
    negative

- Changes in battery_refresh_poll():
  * check now if computed remaining percentage and remaining time values are 
    valid. Now we only add positive values.

Please review.

Cheers,

Danny

 linux2/acpi.c |   40 +++++++++++++++++++++-------------------
 util.c        |   26 +++++++++++++++-----------
 2 files changed, 36 insertions(+), 30 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-fix-normalise_with_unknown_values.diff
Type: text/x-diff
Size: 4211 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20050810/6b358257/hal-fix-normalise_with_unknown_values.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list