udev: recalc last full charge on update in case battery loses maxlife between module restarts

all: do not display time if full && have power


SVN revision: 48985
This commit is contained in:
Mike Blumenkrantz 2010-05-18 20:15:11 +00:00
parent dd4fa1244b
commit fb6a6462c9
2 changed files with 6 additions and 2 deletions

View File

@ -323,7 +323,11 @@ _battery_device_update(void)
return; /* not ready yet, no properties received for any battery */
if (batnum > 0) full /= batnum;
if ((full == 100) && have_power)
{
time_left = -1;
time_full = -1;
}
if (time_left < 1) time_left = -1;
if (time_full < 1) time_full = -1;

View File

@ -213,8 +213,8 @@ _battery_udev_battery_update(const char *syspath, Battery *bat)
GET_STR(bat, model, POWER_SUPPLY_MODEL_NAME);
GET_STR(bat, vendor, POWER_SUPPLY_MANUFACTURER);
GET_NUM(bat, design_charge, POWER_SUPPLY_ENERGY_FULL_DESIGN);
GET_NUM(bat, last_full_charge, POWER_SUPPLY_ENERGY_FULL);
}
GET_NUM(bat, last_full_charge, POWER_SUPPLY_ENERGY_FULL);
test = eeze_udev_syspath_get_property(bat->udi, "POWER_SUPPLY_ENERGY_NOW");
if (test)
{