hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Tue Jan 15 05:00:56 PST 2008
hald/linux/addons/addon-usb-csr.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 5c97b0261d73605c654e6109b87685fcefb7a1b0
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Tue Jan 15 14:00:35 2008 +0100
fix fd.o bug 5865 - don't set percentag if chargelevel is 0
This fixes fd.o bug #5865. Since current_charge == 0 means the battery
or the info isn't available: remove or don't set
battery.charge_level.percentage since it's not mandatory. The key should
be only 0 if it's really at 0 percentage and not if the battery info is
missing.
diff --git a/hald/linux/addons/addon-usb-csr.c b/hald/linux/addons/addon-usb-csr.c
index a761108..b01e5ed 100644
--- a/hald/linux/addons/addon-usb-csr.c
+++ b/hald/linux/addons/addon-usb-csr.c
@@ -150,13 +150,17 @@ check_battery (const char *hal_device_udi, PropertyCacheItem *pci)
HAL_DEBUG (("Charge level: %d->%d", pci->current_charge, current_charge));
if (current_charge != pci->current_charge) {
- pci->current_charge = current_charge; dbus_error_init (&err);
+ pci->current_charge = current_charge; dbus_error_init (&err);
libhal_device_set_property_int (halctx, hal_device_udi,
"battery.charge_level.current", current_charge, &err);
- if (current_charge != 0)
+ if (current_charge != 0) {
percentage = (100.0 / 7.0) * current_charge;
- libhal_device_set_property_int (halctx, hal_device_udi,
- "battery.charge_level.percentage", percentage, &err);
+ libhal_device_set_property_int (halctx, hal_device_udi,
+ "battery.charge_level.percentage", percentage, &err);
+ } else {
+ libhal_device_remove_property(halctx, hal_device_udi,
+ "battery.charge_level.percentage", &err);
+ }
}
}
} else
More information about the hal-commit
mailing list