GNU bug report logs -
#11269
battery.el does not display remaining time when using sysfs
Previous Next
Reported by: Dan Nicolaescu <dann <at> gnu.org>
Date: Wed, 18 Apr 2012 06:38:11 UTC
Severity: normal
Tags: patch
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
After a kernel upgrade battery.el on a machine started using the sysfs
backend instead of the acpi backend.
That info displayed by default now is not very useful because it does
not include "remaining time" like all the other backends do.
I think this might be considered a regression, the display was more
useful in the previous version than it is now.
Here's a fix for that, and fix for the charge in a system with 2
batteries, when one of them is not in use.
Please check this in the appropriate place.
* battery.el (battery-echo-area-format): Display remaining time
for the sysfs backend too.
(battery-linux-sysfs): Fix conditional for the charge.
=== modified file 'lisp/battery.el'
--- lisp/battery.el 2012-04-12 02:04:29 +0000
+++ lisp/battery.el 2012-04-16 16:29:43 +0000
@@ -78,7 +78,7 @@ introduced by a `%' character in a contr
(cond ((eq battery-status-function 'battery-linux-proc-acpi)
"Power %L, battery %B at %r (%p%% load, remaining time %t)")
((eq battery-status-function 'battery-linux-sysfs)
- "Power %L, battery %B (%p%% load)")
+ "Power %L, battery %B (%p%% load, remaining time %t)")
((eq battery-status-function 'battery-pmset)
"%L power, battery %B (%p%% load, remaining time %t)")
(battery-status-function
@@ -509,7 +509,7 @@ The following %-sequences are provided:
"N/A"))
(cons ?d (or temperature "N/A"))
(cons ?B (or charging-state "N/A"))
- (cons ?p (cond ((> charge-full 0)
+ (cons ?p (cond ((and (> charge-full 0) (> charge-now 0))
(format "%.1f"
(/ (* 100 charge-now) charge-full)))
((> energy-full 0)
This bug report was last modified 13 years and 33 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.