hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Jan 29 09:19:50 PST 2008


 hald/linux/device.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 950a003afe5f3072db8e9b26a05b8d3b24fbd09e
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Jan 29 18:18:41 2008 +0100

    fixed refresh_battery_fast() for power_supply: battery.*.rate
    
    Fixed refresh_battery_fast() for power_supply. Added missing key
    battery.voltage.unit and replace not existing key battery.current (this
    key was introduced with 356ccdfa3bbf64648c48da8b756eaccef13d0dd9, but
    the key was never part of the spec!) with  battery.charge_level.rate.
    Added also battery.reporting.rate property.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 93147db..270ef5a 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3054,13 +3054,16 @@ refresh_battery_fast (HalDevice *d)
 	}
 	if (hal_util_get_int_from_file (path, "voltage_max_design", &voltage_design, 10)) {
 		hal_device_property_set_int (d, "battery.voltage.design", voltage_design / 1000);
+		hal_device_property_set_string (d, "battery.voltage.unit", "mV");
 	}
 
 	/* CURRENT: we prefer the average if it exists, although present is still pretty good */
-	if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
-		hal_device_property_set_int (d, "battery.current", current / 1000);
+	if (!hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
+		hal_device_property_set_int (d, "battery.reporting.rate", current);
+		hal_device_property_set_int (d, "battery.charge_level.rate", current / 1000);
 	} else if (hal_util_get_int_from_file (path, "current_now", &current, 10)) {
-		hal_device_property_set_int (d, "battery.current", current / 1000);
+		hal_device_property_set_int (d, "battery.reporting.rate", current);
+		hal_device_property_set_int (d, "battery.charge_level.rate", current / 1000);
 	}
 
 	/* STATUS: Convert to charging/discharging state */


More information about the hal-commit mailing list