[Pkg-wmaker-commits] [wmbattery] 57/241: * Make acpi code put -1 in the time remaining field if the "present rate" is 0. Closes: #204722 * Enable internal time estimate code in this case.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:37:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmbattery.

commit 92bdcdd7f10ee8e3f839f0613b852051415a30b7
Author: joey <joey at a4a2c43b-8ac3-0310-8836-e0e880c912e2>
Date:   Tue Aug 12 20:55:53 2003 +0000

       * Make acpi code put -1 in the time remaining field if the "present rate"
         is 0. Closes: #204722
       * Enable internal time estimate code in this case.
---
 acpi.c           |  5 +++--
 debian/changelog |  8 ++++++++
 wmbattery.c      | 14 ++++----------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/acpi.c b/acpi.c
index cd5a7a3..1b36666 100644
--- a/acpi.c
+++ b/acpi.c
@@ -295,8 +295,9 @@ int acpi_read (int battery, apm_info *info) {
 				goto NOBATT;
 			}
 			else {
-				/* a zero in the file; time unknown */
-				info->battery_time = 0;
+				/* a zero in the file; time unknown so use
+				 * a negative one to indicate this */
+				info->battery_time = -1;
 			}
 		}
 
diff --git a/debian/changelog b/debian/changelog
index 1b68b01..62e0102 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+wmbattery (2.17) unstable; urgency=low
+
+  * Make acpi code put -1 in the time remaining field if the "present rate"
+    is 0. Closes: #204722
+  * Enable internal time estimate code in this case.
+
+ -- Joey Hess <joeyh at debian.org>  Mon, 11 Aug 2003 17:21:17 -0400
+
 wmbattery (2.16) unstable; urgency=low
 
   * Another patch from Hugo Haas, this time it adds time-till-charged
diff --git a/wmbattery.c b/wmbattery.c
index def435c..fa4370b 100644
--- a/wmbattery.c
+++ b/wmbattery.c
@@ -458,22 +458,16 @@ void alarmhandler(int sig) {
 	else if (! use_sonypi) {
 		if (apm_read(&cur_info) != 0)
 			error("Cannot read APM information.");
-		/* Apm uses negative numbers here to indicate error or
-		 * missing battery or something. */
-		if (cur_info.battery_time < 0) {
-			if (! always_estimate_remaining) {
-				/* No battery life indicated; estimate it */
-				estimate_timeleft(&cur_info);
-			}
-		}
 	}
 	else {
 		if (sonypi_read(&cur_info) != 0)
 			error("Cannot read sonypi information.");
 	}
 	
-	/* Always calculate remaining lifetime? */
-	if (always_estimate_remaining)
+	/* Always calculate remaining lifetime? apm and acpi both use a
+	 * negative number here to indicate error, missing battery, or
+	 * cannot determine time. */
+	if (always_estimate_remaining || cur_info.battery_time < 0)
 		estimate_timeleft(&cur_info);
 	
 	/* Override the battery status? */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbattery.git



More information about the Pkg-wmaker-commits mailing list