forked from enlightenment/enlightenment
Remove annoyance.
When e starts in systems under heavy load, it might not get reply from HAL before we need it, so detect batteries that still do not have filled properties and avoid calling _battery_update() if nothing is known. SVN revision: 38946
This commit is contained in:
parent
d6e765033d
commit
82edc2c6da
|
@ -258,6 +258,7 @@ struct _Hal_Battery
|
||||||
const char *model;
|
const char *model;
|
||||||
const char *vendor;
|
const char *vendor;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
Eina_Bool got_prop:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Hal_Ac_Adapter
|
struct _Hal_Ac_Adapter
|
||||||
|
@ -316,6 +317,8 @@ _battery_hal_update(void)
|
||||||
Hal_Battery *hbat;
|
Hal_Battery *hbat;
|
||||||
|
|
||||||
hbat = l->data;
|
hbat = l->data;
|
||||||
|
if (!hbat->got_prop)
|
||||||
|
continue;
|
||||||
have_battery = 1;
|
have_battery = 1;
|
||||||
batnum++;
|
batnum++;
|
||||||
if (hbat->is_charging) have_power = 1;
|
if (hbat->is_charging) have_power = 1;
|
||||||
|
@ -334,6 +337,10 @@ _battery_hal_update(void)
|
||||||
disch += hbat->is_discharging;
|
disch += hbat->is_discharging;
|
||||||
chrg += hbat->is_charging;
|
chrg += hbat->is_charging;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((hal_batteries) && (batnum == 0))
|
||||||
|
return; /* not ready yet, no properties received for any battery */
|
||||||
|
|
||||||
if (batnum > 0) full /= batnum;
|
if (batnum > 0) full /= batnum;
|
||||||
|
|
||||||
if ((disch == 0) && (chrg == 0)) time_left = -1;
|
if ((disch == 0) && (chrg == 0)) time_left = -1;
|
||||||
|
@ -430,6 +437,7 @@ _battery_hal_battery_props(void *data, void *reply_data, DBusError *error)
|
||||||
GET_BOOL(is_charging, "battery.rechargeable.is_charging");
|
GET_BOOL(is_charging, "battery.rechargeable.is_charging");
|
||||||
GET_BOOL(is_discharging, "battery.rechargeable.is_discharging");
|
GET_BOOL(is_discharging, "battery.rechargeable.is_discharging");
|
||||||
|
|
||||||
|
hbat->got_prop = 1;
|
||||||
_battery_hal_update();
|
_battery_hal_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue