[gpm] [PATCH] Don't treat percentage=0 as error condition



On some (broken) battery controllers, the percentage drops to 0 just
before the battery runs out. Rather than ignoring it, we should run the
critical percentage policy action anyway.

Patch is attached.

-- 
Kind regards,
Chow Loong Jin (GPG: 0x8F02A411)
Ubuntu Developer
From 3abbe3ba4892db254bde096f907b409ef37ed82a Mon Sep 17 00:00:00 2001
From: Chow Loong Jin <hyperair ubuntu com>
Date: Thu, 25 Mar 2010 21:12:14 +0800
Subject: [PATCH] Don't treat percentage=0 as error condition

On some (broken) battery controllers, the percentage drops to 0 just
before the battery runs out. Rather than ignoring it, we should run the
critical percentage policy action anyway.
---
 src/gpm-engine.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index c768b2e..e0ce38c 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -123,11 +123,6 @@ gpm_engine_get_warning_percentage (GpmEngine *engine, DkpDevice *device)
 	/* get device properties */
 	g_object_get (device, "percentage", &percentage, NULL);
 
-	/* this is probably an error condition */
-	if (percentage == 0) {
-		egg_warning ("percentage zero, something's gone wrong");
-		return GPM_ENGINE_WARNING_NONE;
-	}
 	if (percentage <= engine->priv->action_percentage)
 		return GPM_ENGINE_WARNING_ACTION;
 	if (percentage <= engine->priv->critical_percentage)
-- 
1.6.3.3

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]