[Pkg-wmaker-commits] [wmbattery] 113/241: Add -s option which can be used to ignore fluctuations in reported battery charge (as seen on the EeePC) when using -e. Closes: #527870 (Joseph Huang)

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:37:43 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 5bc3fe3f2f8d9614818319ed6b3eea2e3ee171e5
Author: Joey Hess <joey at gnu.kitenet.net>
Date:   Sat May 9 16:50:30 2009 -0400

    Add -s option which can be used to ignore fluctuations in reported battery charge (as seen on the EeePC) when using -e. Closes: #527870 (Joseph Huang)
---
 debian/changelog |  8 ++++++++
 wmbattery.1x     |  4 ++++
 wmbattery.c      | 13 ++++++++++---
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7e77d83..737af14 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+wmbattery (2.40) UNRELEASED; urgency=low
+
+  * Add -s option which can be used to ignore fluctuations
+    in reported battery charge (as seen on the EeePC) when
+    using -e. Closes: #527870 (Joseph Huang)
+
+ -- Joey Hess <joeyh at debian.org>  Sat, 09 May 2009 16:41:51 -0400
+
 wmbattery (2.39) unstable; urgency=low
 
   * Use debhelper v7; rules file minimisation.
diff --git a/wmbattery.1x b/wmbattery.1x
index abdcea1..f879afc 100644
--- a/wmbattery.1x
+++ b/wmbattery.1x
@@ -97,6 +97,10 @@ and until full charge, and this code is used if no other source of this
 informaton is available. This switch makes wmbattery use its time 
 estimation code even if some other estimate is available.
 .TP
+.B \-s granularity
+Ignore fluctuations less than the specified granularity percent when
+estimating time. (Implies -e)
+.TP
 .B \-a file.au
 Play the specified au file (by sending it to /dev/audio) when the battery
 is low.
diff --git a/wmbattery.c b/wmbattery.c
index 026e054..454568e 100644
--- a/wmbattery.c
+++ b/wmbattery.c
@@ -45,6 +45,7 @@ int use_sonypi = 0;
 int use_acpi = 0;
 int delay = 0;
 int always_estimate_remaining = 0;
+int granularity_estimate_remaining = 1;
 
 signed int low_pct = -1;
 signed int critical_pct = -1;
@@ -125,7 +126,8 @@ void estimate_timeleft(apm_info *cur_info) {
 	}
 
 	/* No change: decrease estimate */
-	if (percent == cur_info->battery_percentage) {
+	if ((percent - cur_info->battery_percentage)
+	    / granularity_estimate_remaining == 0) {
 		estimate -= t - estimate_time;
 		estimate_time = t;
 		if (guessed_lately && estimate < 0)
@@ -206,7 +208,7 @@ char *parse_commandline(int argc, char *argv[]) {
 	extern char *optarg;
 	
   	while (c != -1) {
-  		c=getopt(argc, argv, "hd:g:f:b:w:c:l:ea:");
+  		c=getopt(argc, argv, "hd:g:f:b:w:c:l:es:a:");
 		switch (c) {
 		  case 'h':
 			printf("Usage: wmbattery [options]\n");
@@ -218,7 +220,8 @@ char *parse_commandline(int argc, char *argv[]) {
 			printf("\t-l percent\tlow percentage\n");
 			printf("\t-c percent\tcritical percentage\n");
 			printf("\t-e\t\tuse own time estimates\n");
-			printf("\t-a file\t\twhen critical send file to /dv/audio\n");
+			printf("\t-s granularity\tignore fluctuations less than granularity%% (implies -e)\n");
+			printf("\t-a file\t\twhen critical send file to /dev/audio\n");
                		exit(0);
 		 	break;
 		  case 'd':
@@ -251,6 +254,10 @@ char *parse_commandline(int argc, char *argv[]) {
 		  case 'e':
 			always_estimate_remaining = 1;
 			break;
+		  case 's':
+			always_estimate_remaining = 1;
+			granularity_estimate_remaining = atoi(optarg);
+			break;
 		  case 'a':
 			crit_audio_fn = strdup(optarg);
 			break;

-- 
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