unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX
@ 2015-02-18 15:53 Greg Farough
  2016-03-21  5:44 ` Marcin Borkowski
  2019-09-20 23:44 ` Stefan Kangas
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Farough @ 2015-02-18 15:53 UTC (permalink / raw)
  To: 19895

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

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX
  2015-02-18 15:53 bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX Greg Farough
@ 2016-03-21  5:44 ` Marcin Borkowski
  2019-09-20 23:44 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Marcin Borkowski @ 2016-03-21  5:44 UTC (permalink / raw)
  To: Greg Farough; +Cc: 19895

On 2015-02-18, at 09:53, Greg Farough <gregf@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX
  2015-02-18 15:53 bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX Greg Farough
  2016-03-21  5:44 ` Marcin Borkowski
@ 2019-09-20 23:44 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2019-09-20 23:44 UTC (permalink / raw)
  To: Greg Farough; +Cc: 19895-done

Greg Farough <gregf@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@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-20 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-18 15:53 bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX Greg Farough
2016-03-21  5:44 ` Marcin Borkowski
2019-09-20 23:44 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).