stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] battery-portable depends on deprecated current_now


From: Daniel Borchmann
Subject: [STUMP] battery-portable depends on deprecated current_now
Date: Fri, 29 Apr 2011 09:25:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi,

I recently realized that the battery-portable module depends on the file
current_now, which is supposed to be exported by the Linux kernel. If
I'm not mistaken, this file has been deprecated around 2.6.30 and does
not exist anymore in 2.6.38 (at least). Instead, power_now is now
exported which should take the same value. Using it may fix this issue.

Best,
Daniel

(Please test this, I've made this changes on another computer and just
rewrote it out of memory)

diff --git a/contrib/battery-portable.lisp b/contrib/battery-portable.lisp
index 99a28a5..9cc66ad 100644
--- a/contrib/battery-portable.lisp
+++ b/contrib/battery-portable.lisp
@@ -211,7 +211,9 @@
           (if (string= (sysfs-field path "present") "0")
               :unknown
               (let* ((state (sysfs-field path "status"))
-                     (consumption (sysfs-int-field path "current_now"))
+                     (consumption (or (sysfs-int-field-or-nil path "power_now")
+                                      (sysfs-int-field-or-nil path 
"current_now")
+                                      (return-from state-of :unknown)))
                      (curr (or (sysfs-int-field-or-nil path "energy_now")
                                ;; energy_* seems not to be there on
                                ;; some boxes. Strange...


-- 
Daniel Borchmann                    http://www.math.tu-dresden.de/~borch
GPG (Mail)            04A9 66A1 A17C C91E 39B5  8722 69B0 E96D A109 8F58
--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]