[gnome-power-manager/gnome-2-24] Fix laptops not hibernating on low battery
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager/gnome-2-24] Fix laptops not hibernating on low battery
- Date: Thu, 14 May 2009 07:19:53 -0400 (EDT)
commit 058daf7dfda6554dcf5815b2c910a550778caae9
Author: Vincent Untz <vuntz gnome org>
Date: Thu May 14 13:18:58 2009 +0200
Fix laptops not hibernating on low battery
Do not recompute the percentage based on the charge when the percentage
reported by hal is less or equal than 1%. It seems hal doesn't computer
the percentage the same was as gnome-power-manager, and it can happen
that when we get the final event from hal, gnome-power-manager still
thinks it's too early for the critical action. However, since this was
the last event from hal, the critical action will never be triggered.
Fix bug #559578.
---
ChangeLog | 12 ++++++++++++
src/gpm-cell-array.c | 3 ++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9290d87..f99c259 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-14 Vincent Untz <vuntz gnome org>
+
+ * src/gpm-cell-array.c: (gpm_cell_array_update): do not recompute the
+ percentage based on the charge when the percentage reported by hal is
+ less or equal than 1%. It seems hal doesn't computer the percentage the
+ same was as gnome-power-manager, and it can happen that when we get the
+ final event from hal, gnome-power-manager still thinks it's too early
+ for the critical action. However, since this was the last event from
+ hal, the critical action will never be triggered.
+ This should fix laptops not hibernating on low battery.
+ Fix bug #559578.
+
2009-02-27 Richard Hughes <richard hughsie com>
* src/gpm-button.c: (hal_daemon_new_device_cb), (gpm_button_init):
diff --git a/src/gpm-cell-array.c b/src/gpm-cell-array.c
index 0203176..cfda489 100644
--- a/src/gpm-cell-array.c
+++ b/src/gpm-cell-array.c
@@ -355,7 +355,8 @@ gpm_cell_array_update (GpmCellArray *cell_array)
* get an with batteries which have a very small charge unit and consequently
* a very high charge. Fixes bug #327471 */
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY &&
- unit->charge_current > 0 && unit->charge_last_full > 0) {
+ unit->charge_current > 0 && unit->charge_last_full > 0 &&
+ unit->percentage > 1) {
gfloat pc = 100.0f * ((gfloat)unit->charge_current /
(gfloat)unit->charge_last_full);
if (pc < 0.0f) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]