GNU bug report logs - #19895
24.4; battery.el does not support /sys/class/power_supply/BATX

Previous Next

Package: emacs;

Reported by: Greg Farough <gregf <at> riseup.net>

Date: Wed, 18 Feb 2015 16:54:01 UTC

Severity: normal

Found in version 24.4

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19895 in the body.
You can then email your comments to 19895 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19895; Package emacs. (Wed, 18 Feb 2015 16:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Greg Farough <gregf <at> riseup.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 18 Feb 2015 16:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Greg Farough <gregf <at> riseup.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; battery.el does not support /sys/class/power_supply/BATX
Date: Wed, 18 Feb 2015 09:53:59 -0600
It seems that battery-linux-sysfs does not support certain laptop
batteries which are not classified as BAT0, but by BATX instead. I had
to add this to my .emacs to get display-battery-mode working properly:

(eval-after-load 'battery
  '(progn
     (setq battery--linux-sysfs-regexp "[bB][aA][tT][xX]$")
     (setq battery-status-function 'battery-linux-sysfs
      battery-echo-area-format "Power %L, battery %B (%p%% charged, remaining time %t)"
      battery-mode-line-format " [%p%%] ")))
(display-battery-mode 1)

Hope this helps, and thanks for all your hard work.
-g

-- 
Ξυνὸν δέ μοί ἐστιν, ὁππόθεν ἄρξωμαι· τόθι γὰρ πάλιν ἵξομαι αὖθις.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19895; Package emacs. (Mon, 21 Mar 2016 05:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 19895 <at> debbugs.gnu.org (full text, mbox):

From: Marcin Borkowski <mbork <at> mbork.pl>
To: Greg Farough <gregf <at> riseup.net>
Cc: 19895 <at> debbugs.gnu.org
Subject: Re: bug#19895: 24.4;
 battery.el does not support /sys/class/power_supply/BATX
Date: Mon, 21 Mar 2016 06:44:46 +0100
On 2015-02-18, at 09:53, Greg Farough <gregf <at> riseup.net> wrote:

> It seems that battery-linux-sysfs does not support certain laptop
> batteries which are not classified as BAT0, but by BATX instead. I had
> to add this to my .emacs to get display-battery-mode working properly:
>
> (eval-after-load 'battery
>   '(progn
>      (setq battery--linux-sysfs-regexp "[bB][aA][tT][xX]$")
>      (setq battery-status-function 'battery-linux-sysfs
>       battery-echo-area-format "Power %L, battery %B (%p%% charged, remaining time %t)"
>       battery-mode-line-format " [%p%%] ")))
> (display-battery-mode 1)
>
> Hope this helps, and thanks for all your hard work.
> -g

Hi,

thanks for your report.  IMHO, this suggests a simple patch, replacing

(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$")

with e.g.

(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9X]?$")

in battery.el.  Could someone more knowledgeable about what sits in
/sys/class/power_supply/ confirm that this shouldn't break anything?
(On my laptop, the right directory is called BAT0, btw.)

Best,

-- 
Marcin




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Fri, 20 Sep 2019 23:46:01 GMT) Full text and rfc822 format available.

Notification sent to Greg Farough <gregf <at> riseup.net>:
bug acknowledged by developer. (Fri, 20 Sep 2019 23:46:01 GMT) Full text and rfc822 format available.

Message #13 received at 19895-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Greg Farough <gregf <at> riseup.net>
Cc: 19895-done <at> debbugs.gnu.org
Subject: Re: bug#19895: 24.4;
 battery.el does not support /sys/class/power_supply/BATX
Date: Sat, 21 Sep 2019 01:44:58 +0200
Greg Farough <gregf <at> riseup.net> writes:

> It seems that battery-linux-sysfs does not support certain laptop
> batteries which are not classified as BAT0, but by BATX instead. I had
> to add this to my .emacs to get display-battery-mode working properly:
>
> (eval-after-load 'battery
>   '(progn
>      (setq battery--linux-sysfs-regexp "[bB][aA][tT][xX]$")
>      (setq battery-status-function 'battery-linux-sysfs
>       battery-echo-area-format "Power %L, battery %B (%p%% charged, remaining time %t)"
>       battery-mode-line-format " [%p%%] ")))
> (display-battery-mode 1)

This has been fixed by the following commit on current master branch,
which makes 'M-x battery' list all batteries no matter what they're
named:

commit 6b38e34a11a85d50fa384b90ed21ea60d6d646d5
Author: Lars Ingebrigtsen <larsi <at> gnus.org>
Date:   Fri Aug 23 02:40:26 2019 +0200
    Have `M-x battery' list all batteries under GNU/Linux

I'm therefore closing this bug report.  If you could please verify that
the fix works for you and report back, that would be even better.

Best regards,
Stefan Kangas




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Oct 2019 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.