[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10332: battery.el not working when multiple batteries are present
From: |
Dan Nicolaescu |
Subject: |
bug#10332: battery.el not working when multiple batteries are present |
Date: |
Mon, 19 Dec 2011 17:36:00 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
On a machine that has a normal battery and another one that can be put
in the CD/DVD slot M-x battery does not work when both batteries are
present.
Only one battery is discharged at a time, but that seems to confuse
battery.el when computing `rate-type' for the battery not being
discharged.
Here's a proposed patch.
=== modified file 'lisp/battery.el'
--- lisp/battery.el 2011-10-19 12:54:24 +0000
+++ lisp/battery.el 2011-10-20 21:40:57 +0000
@@ -337,14 +337,15 @@
(setq charging-state (match-string 1)))
(when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
nil t)
- (setq rate (+ (or rate 0) (string-to-number (match-string 1)))
- rate-type (or (and rate-type
+ (setq rate (+ (or rate 0) (string-to-number (match-string 1))))
+ (when (> rate 0)
+ (setq rate-type (or (and rate-type
(if (string= rate-type (match-string 2))
rate-type
(error
"Inconsistent rate types (%s vs. %s)"
rate-type (match-string 2))))
- (match-string 2))))
+ (match-string 2)))))
(when (re-search-forward "remaining capacity: +\\([0-9]+\\) m[AW]h$"
nil t)
(setq capacity
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#10332: battery.el not working when multiple batteries are present,
Dan Nicolaescu <=