From unknown Fri Aug 15 04:08:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25559: Trouble getting battery status Resent-From: Rahul Martim Juliato Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2017 00:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 25559@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.148556306931941 (code B ref -1); Sat, 28 Jan 2017 00:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jan 2017 00:24:29 +0000 Received: from localhost ([127.0.0.1]:48686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXGof-0008J7-3p for submit@debbugs.gnu.org; Fri, 27 Jan 2017 19:24:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXGeO-00082O-Ss for submit@debbugs.gnu.org; Fri, 27 Jan 2017 19:13:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXGeI-00045m-Q4 for submit@debbugs.gnu.org; Fri, 27 Jan 2017 19:13:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXGeI-00045d-Mh for submit@debbugs.gnu.org; Fri, 27 Jan 2017 19:13:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXGeH-0004KP-N3 for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2017 19:13:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXGeE-00044s-IA for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2017 19:13:45 -0500 Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:34072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXGeE-00044k-Dz for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2017 19:13:42 -0500 Received: by mail-qk0-x230.google.com with SMTP id j126so60124500qkf.1 for ; Fri, 27 Jan 2017 16:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=Li4VNa9sX6q/6qwO6Um9+5hG7HVN4DlD5U5A3a+PUmY=; b=MK2TQjmn893CSAgfjz0NJdZbghsq+ZEXEVVsm1L8nenSM++9KDy3iFWxbuLvzvD2Be jZpfR1+CKnnR1n2de/q0jtR26L1X6dwm0R5b1QeC41Rpo/HNCHJV1bDME8nfXqr4osG4 Rhyz0RvCVLmFPGd1voxTh/fGCcEC95fmNL3g7JGbtbZ6RI5+OF3hRJd7uM1QIwPIiFWY zOAIJp083vF11ZokJogVtkCyhDAtvgweXNl6aHkqdCdA2+W6P9B+RBJ9Hu0mP4ESIKCH 6H0MdvX9385LLMgRs3TDLQPsxWQT2y/dOczyIhNX43WF6Wg9zKlUuZ6y3bvnOLyy26b1 G2vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=Li4VNa9sX6q/6qwO6Um9+5hG7HVN4DlD5U5A3a+PUmY=; b=HHYdwG/JfE8vA8Hh7X0ucgHYFOoNP4QjwVpviMOdv8IRdo3qFH2NiNwCS6Pn9HjrvI 14HL90u9XU1bgcAZhkCwWcUYOHBz7p9/f5RuIN3aa7I5ewV64VnE8VDZ7nR/oC5iDRFp XCpseygSDKIWLCWzdAiuetjCj40DTqF7nLCv/w5GE6YOYppXuyFjWLrWNHZ3uyemi1wu n3vwUloYmQeJM/aAvlRpTPFoh9enhbujsyNvqxtDAMeLU7HOnreH9yNB2mLJ4GcT9bgO rngQrKxp3e6fnXeluCJ8B/Z+eutFTgARdL5qwFW/zTD5pgPaZmb1KgxVhfAaVI9DV4qO I+6Q== X-Gm-Message-State: AIkVDXIAO9E4CV/V/ovBT+CkXmZvjxjsp0lDggcFEO8QJvBshzQEGuO3IqX09uN5xehZ/g== X-Received: by 10.55.122.194 with SMTP id v185mr10028682qkc.99.1485562420274; Fri, 27 Jan 2017 16:13:40 -0800 (PST) Received: from alarm ([187.180.145.199]) by smtp.gmail.com with ESMTPSA id q5sm5460045qtc.36.2017.01.27.16.13.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Jan 2017 16:13:39 -0800 (PST) From: Rahul Martim Juliato X-Google-Original-From: Rahul Martim Juliato Date: Fri, 27 Jan 2017 22:13:34 -0200 Message-ID: <86wpdgavo1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Fri, 27 Jan 2017 19:24:27 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello! battery.el gives me an error, where is not possible to find my battery info directory. I'm on a 32 bit ARM, Arch Linux with 3.8.11 kernel, Samsung Chromebook, and on the proc directoy this is what I have: ~ $ ls -l /sys/class/power_supply/ total 0 lrwxrwxrwx 1 root root 0 2017-01-27 21:48 sbs-104-000b -> ../../devices/12ca0000.i2c/i2c-4/i2c-104/104-000b/power_supply/sbs-104-000b lrwxrwxrwx 1 root root 0 2017-01-27 21:47 tps65090-ac -> ../../devices/12ca0000.i2c/i2c-4/i2c-104/104-0048/tps65090-charger/power_supply/tps65090-ac ~ $ That means, I have 2 sub-directories, and battery info is inside sbs-104-000b. Taking a look into battery.el, it seems that the program does not tests for inner directories possibility. It would be nice for this to look for it, or at least give me possibility to point the exactly location in a variable. Thanks, Rahul From unknown Fri Aug 15 04:08:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25559: Trouble getting battery status Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Jul 2019 15:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Rahul Martim Juliato Cc: 25559@debbugs.gnu.org Received: via spool by 25559-submit@debbugs.gnu.org id=B25559.15641535905171 (code B ref 25559); Fri, 26 Jul 2019 15:07:02 +0000 Received: (at 25559) by debbugs.gnu.org; 26 Jul 2019 15:06:29 +0000 Received: from localhost ([127.0.0.1]:43157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr1nh-0001LK-CE for submit@debbugs.gnu.org; Fri, 26 Jul 2019 11:06:29 -0400 Received: from quimby.gnus.org ([80.91.231.51]:38132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr1nf-0001L4-Bi for 25559@debbugs.gnu.org; Fri, 26 Jul 2019 11:06:28 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hr1nb-0001Em-5U; Fri, 26 Jul 2019 17:06:25 +0200 From: Lars Ingebrigtsen References: <86wpdgavo1.fsf@gmail.com> Date: Fri, 26 Jul 2019 17:06:22 +0200 In-Reply-To: <86wpdgavo1.fsf@gmail.com> (Rahul Martim Juliato's message of "Fri, 27 Jan 2017 22:13:34 -0200") Message-ID: <878sskltsh.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Rahul Martim Juliato writes: > battery.el gives me an error, where is not possible to find my battery > info directory. > > I'm on a 32 bit ARM, Arch Linux with 3.8.11 kernel, Samsung Chromebook, > and on the proc directoy this i [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Rahul Martim Juliato writes: > battery.el gives me an error, where is not possible to find my battery > info directory. > > I'm on a 32 bit ARM, Arch Linux with 3.8.11 kernel, Samsung Chromebook, > and on the proc directoy this is what I have: > > ~ $ ls -l /sys/class/power_supply/ > total 0 > lrwxrwxrwx 1 root root 0 2017-01-27 21:48 sbs-104-000b -> > ../../devices/12ca0000.i2c/i2c-4/i2c-104/104-000b/power_supply/sbs-104-000b > lrwxrwxrwx 1 root root 0 2017-01-27 21:47 tps65090-ac -> > ../../devices/12ca0000.i2c/i2c-4/i2c-104/104-0048/tps65090-charger/power_supply/tps65090-ac > ~ $ > > That means, I have 2 sub-directories, and battery info is inside > sbs-104-000b. > > Taking a look into battery.el, it seems that the program does not tests > for inner directories possibility. It looks like it just looks for batteries named BATx: (defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" That seems unnecessary -- surely we can just look into all the directories there and see whether it looks like we have a battery directory? The patch below does this, but perhaps it's problematic. Do all power_supply/ directories have a "capacity" file, or does that vary by Linux kernel version? diff --git a/lisp/battery.el b/lisp/battery.el index 7037d07dcf..9a09093d48 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -38,13 +38,6 @@ battery :prefix "battery-" :group 'hardware) -(defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" - "Regexp for folder names to be searched under - /sys/class/power_supply/ that contain battery information." - :version "26.1" - :type 'regexp - :group 'battery) - (defcustom battery-upower-device "battery_BAT1" "Upower battery device name." :version "26.1" @@ -60,8 +53,8 @@ battery-status-function #'battery-linux-proc-acpi) ((and (eq system-type 'gnu/linux) (file-directory-p "/sys/class/power_supply/") - (directory-files "/sys/class/power_supply/" nil - battery-linux-sysfs-regexp)) + (directory-files-recursively "/sys/class/power_supply/" + "\\`capacity\\'" nil nil t)) #'battery-linux-sysfs) ((and (eq system-type 'berkeley-unix) (file-executable-p "/usr/sbin/apm")) @@ -449,9 +442,10 @@ battery-linux-sysfs ;; available information together. (with-temp-buffer (dolist (dir (ignore-errors - (directory-files - "/sys/class/power_supply/" t - battery-linux-sysfs-regexp))) + (mapcar + #'file-name-directory + (directory-files-recursively + "/sys/class/power_supply/" "\\`capacity\\'" nil nil t)))) (erase-buffer) (ignore-errors (insert-file-contents (expand-file-name "uevent" dir))) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 26 11:06:32 2019 Received: (at control) by debbugs.gnu.org; 26 Jul 2019 15:06:32 +0000 Received: from localhost ([127.0.0.1]:43160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr1nj-0001LZ-Qo for submit@debbugs.gnu.org; Fri, 26 Jul 2019 11:06:31 -0400 Received: from quimby.gnus.org ([80.91.231.51]:38148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr1nj-0001LT-6u for control@debbugs.gnu.org; Fri, 26 Jul 2019 11:06:31 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hr1ng-0001F7-KW for control@debbugs.gnu.org; Fri, 26 Jul 2019 17:06:30 +0200 Date: Fri, 26 Jul 2019 17:06:28 +0200 Message-Id: <877e84ltsb.fsf@mouse.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #25559 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 25559 + patch quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 25559 + patch quit From unknown Fri Aug 15 04:08:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25559: Trouble getting battery status Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2019 00:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Rahul Martim Juliato Cc: 25559@debbugs.gnu.org Received: via spool by 25559-submit@debbugs.gnu.org id=B25559.156652091516814 (code B ref 25559); Fri, 23 Aug 2019 00:42:02 +0000 Received: (at 25559) by debbugs.gnu.org; 23 Aug 2019 00:41:55 +0000 Received: from localhost ([127.0.0.1]:38596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0xeN-0004N7-67 for submit@debbugs.gnu.org; Thu, 22 Aug 2019 20:41:55 -0400 Received: from quimby.gnus.org ([80.91.231.51]:36348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0xeL-0004My-C3 for 25559@debbugs.gnu.org; Thu, 22 Aug 2019 20:41:54 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i0xeF-00021L-Mc; Fri, 23 Aug 2019 02:41:51 +0200 From: Lars Ingebrigtsen References: <86wpdgavo1.fsf@gmail.com> <878sskltsh.fsf@mouse.gnus.org> Date: Fri, 23 Aug 2019 02:41:47 +0200 In-Reply-To: <878sskltsh.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Fri, 26 Jul 2019 17:06:22 +0200") Message-ID: <87wof4af1w.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > It looks like it just looks for batteries named BATx: > > (defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" > > That seems unnecessary -- surely we can just look into all the > directories [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > It looks like it just looks for batteries named BATx: > > (defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" > > That seems unnecessary -- surely we can just look into all the > directories there and see whether it looks like we have a battery > directory? The patch below does this, but perhaps it's problematic. Do > all power_supply/ directories have a "capacity" file, or does > that vary by Linux kernel version? There were no comments, and I've tested the patch on three different GNU/Linux systems, and it seems to work OK. But like I said, I'm not extremely confident about this change -- if this leads to problems, feel free to revert. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 22 20:42:01 2019 Received: (at control) by debbugs.gnu.org; 23 Aug 2019 00:42:01 +0000 Received: from localhost ([127.0.0.1]:38599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0xeT-0004NU-E3 for submit@debbugs.gnu.org; Thu, 22 Aug 2019 20:42:01 -0400 Received: from quimby.gnus.org ([80.91.231.51]:36362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0xeS-0004NN-2d for control@debbugs.gnu.org; Thu, 22 Aug 2019 20:42:00 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i0xeP-00021S-Gt for control@debbugs.gnu.org; Fri, 23 Aug 2019 02:41:59 +0200 Date: Fri, 23 Aug 2019 02:41:57 +0200 Message-Id: <87v9uoaf1m.fsf@mouse.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #25559 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 25559 fixed close 25559 27.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 25559 fixed close 25559 27.1 quit