unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Support for multiple batteries
@ 2020-02-27  3:38 Richard Stallman
  2020-02-28  7:43 ` Eli Zaretskii
  2020-06-11 16:08 ` Basil L. Contovounesios
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Stallman @ 2020-02-27  3:38 UTC (permalink / raw)
  To: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Has proper support for multiple batteries in battery.el
been reimplemented yet?  I use that case, and I wrote the
old code to handle it.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-02-27  3:38 Support for multiple batteries Richard Stallman
@ 2020-02-28  7:43 ` Eli Zaretskii
  2020-02-28 10:21   ` lg.zevlg
  2020-06-11 16:08 ` Basil L. Contovounesios
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2020-02-28  7:43 UTC (permalink / raw)
  To: rms, Zajcev Evgeny; +Cc: emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Date: Wed, 26 Feb 2020 22:38:56 -0500
> 
> Has proper support for multiple batteries in battery.el
> been reimplemented yet?

Not that I could see.

Evgeny, did you have a chance to look at bug#39491?



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

* Re: Support for multiple batteries
  2020-02-28  7:43 ` Eli Zaretskii
@ 2020-02-28 10:21   ` lg.zevlg
  2020-02-28 12:57     ` Eli Zaretskii
  2020-03-01  3:46     ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: lg.zevlg @ 2020-02-28 10:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Zajcev Evgeny, rms, emacs-devel


> 28 февр. 2020 г., в 10:43, Eli Zaretskii <eliz@gnu.org> написал(а):
> 
> 
>> 
>> From: Richard Stallman <rms@gnu.org>
>> Date: Wed, 26 Feb 2020 22:38:56 -0500
>> 
>> Has proper support for multiple batteries in battery.el
>> been reimplemented yet?
> 
> Not that I could see.
> 
> Evgeny, did you have a chance to look at bug#39491?

I started working on this.  Not yet done

—
lg




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

* Re: Support for multiple batteries
  2020-02-28 10:21   ` lg.zevlg
@ 2020-02-28 12:57     ` Eli Zaretskii
  2020-03-01  3:46     ` Richard Stallman
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2020-02-28 12:57 UTC (permalink / raw)
  To: lg.zevlg; +Cc: zevlg, rms, emacs-devel

> From: lg.zevlg@gmail.com
> Date: Fri, 28 Feb 2020 13:21:10 +0300
> Cc: Zajcev Evgeny <zevlg@yandex.ru>, rms@gnu.org, emacs-devel@gnu.org
> 
> > Evgeny, did you have a chance to look at bug#39491?
> 
> I started working on this.  Not yet done

Thanks for working on this.



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

* Re: Support for multiple batteries
  2020-02-28 10:21   ` lg.zevlg
  2020-02-28 12:57     ` Eli Zaretskii
@ 2020-03-01  3:46     ` Richard Stallman
  2020-03-03  3:37       ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2020-03-01  3:46 UTC (permalink / raw)
  To: lg.zevlg; +Cc: eliz, zevlg, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > theo.bondolfi@zen3.org

I'm glad to know it is being worked on.  Thanks.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-03-01  3:46     ` Richard Stallman
@ 2020-03-03  3:37       ` Richard Stallman
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2020-03-03  3:37 UTC (permalink / raw)
  To: lg.zevlg; +Cc: eliz, zevlg, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Sorry, I quoted irrelevant text in my previous message.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-02-27  3:38 Support for multiple batteries Richard Stallman
  2020-02-28  7:43 ` Eli Zaretskii
@ 2020-06-11 16:08 ` Basil L. Contovounesios
  2020-06-13  4:02   ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Basil L. Contovounesios @ 2020-06-11 16:08 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Has proper support for multiple batteries in battery.el
> been reimplemented yet?  I use that case, and I wrote the
> old code to handle it.

What exactly do you mean by "proper" support?

AFAICT only two battery status backends currently support multiple
sources of information: battery-linux-sysfs and battery-linux-proc-acpi,
for Linux sysfs and ACPI support, respectively.

The way they handle multiple batteries is by merging multiple data into
a single report.  Is this what you mean by "proper" support, or do you
envision some other way to report on multiple batteries?

My patch in https://debbugs.gnu.org/39491#55 also adds support for
multiple power sources to battery-upower, for UPower support.

It is possible that the other backends also support multiple batteries
if the single source they query is already summarising data from
multiple batteries, but I'm not familiar enough with APM, pmset, or MS
Windows to say.

-- 
Basil



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

* Re: Support for multiple batteries
  2020-06-11 16:08 ` Basil L. Contovounesios
@ 2020-06-13  4:02   ` Richard Stallman
  2020-06-13 11:48     ` Basil L. Contovounesios
  2020-06-13 19:42     ` Drew Adams
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Stallman @ 2020-06-13  4:02 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > AFAICT only two battery status backends currently support multiple
  > sources of information: battery-linux-sysfs and battery-linux-proc-acpi,
  > for Linux sysfs and ACPI support, respectively.

Could you clear up for me what "currently" means in this context?  I
don't know what code was changed in January or so -- only that the
change led to incorrect reports, on a Thinkpad T400s with two
batteries inserted.

  > The way they handle multiple batteries is by merging multiple data into
  > a single report.

I am not sure what that means, concretely.

                      Is this what you mean by "proper" support,

Proper support means at least giving a good estimate for how long
before the machine runs out of energy, and a good estimate of the
actual fraction of maximum charge the batteries can hold.  The code
from last October could do that.

When I type M-x battery in the version as of October 2,
it displays something like

  Power BAT, battery Discharging (98.1% load, remaining time 4:04)

where the numbers depend on the energy capacity of each battery and
the current charge of each battery, as well as the actual current or
power.

That is what I think is crucial for M-x battery.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-06-13  4:02   ` Richard Stallman
@ 2020-06-13 11:48     ` Basil L. Contovounesios
  2020-06-14 13:40       ` Richard Stallman
  2020-06-13 19:42     ` Drew Adams
  1 sibling, 1 reply; 13+ messages in thread
From: Basil L. Contovounesios @ 2020-06-13 11:48 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > AFAICT only two battery status backends currently support multiple
>   > sources of information: battery-linux-sysfs and battery-linux-proc-acpi,
>   > for Linux sysfs and ACPI support, respectively.
>
> Could you clear up for me what "currently" means in this context?  I
> don't know what code was changed in January or so -- only that the
> change led to incorrect reports, on a Thinkpad T400s with two
> batteries inserted.

The battery.el package provides a user option battery-status-function
which determines how to query the system for information on its power
sources.  When battery.el is loaded, it checks for the availability of
various system features in order to set the user option to the most
sensible default out of a known set of possible values.  Each of these
values is a function (a "backend") which returns an alist of all
relevant battery information, such as load, time to discharge, etc.

Emacs 26.1[1] introduced a new possible value for
battery-status-function, namely battery-upower, which gets its
information from a UPower[2] D-Bus service (daemon) running on the
system[3].  This backend was disabled by default, i.e. in order to use
it, a user would have to manually set battery-status-function to
battery-upower.

In early February[4], the battery-upower code was improved and
battery-status-function was changed to default to battery-upower if the
system provides a UPower service.  This can be perceived as a regression
on multi-battery systems because battery-upower currently assumes a
single battery, whereas the previous defaults of battery-status-function
on modern GNU/Linux systems (battery-linux-sysfs and
battery-linux-proc-acpi) support multiple batteries.  The patch in [5]
adds support for multiple batteries to battery-upower as well, so that
it can remain the default backend when applicable.

[1]: * lisp/battery.el: Add 'battery-upower' -- very fast battery status.
05a969265c 2016-12-02 12:17:38 +0200
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=05a969265cabdf361492ed471f1a8dc369840401

[2]: https://upower.freedesktop.org/

[3]: https://www.freedesktop.org/wiki/Software/dbus/

[4]: Make 'M-x battery RET' work out-of-box for UPower users.
d8f4317f03 2020-02-06 09:13:19 -0500
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d8f4317f03be69cfaf6a60bda228996590fd92b5

[5]: https://debbugs.gnu.org/39491#55

>   > The way they handle multiple batteries is by merging multiple data into
>   > a single report.
>
> I am not sure what that means, concretely.

The current multi-battery-aware backends, battery-linux-sysfs (which
uses the /sys/class/power_supply filesystem) and battery-linux-proc-acpi
(which uses the /proc/acpi filesystem), iterate over each battery file,
collecting and summing various relevant data, and then return them as
aggregate values.

For example, they sum the current energy and energy-when-full of each
battery, and divide the former by the latter to get the combined load
percentage.

>                       Is this what you mean by "proper" support,
>
> Proper support means at least giving a good estimate for how long
> before the machine runs out of energy, and a good estimate of the
> actual fraction of maximum charge the batteries can hold.  The code
> from last October could do that.
>
> When I type M-x battery in the version as of October 2,
> it displays something like
>
>   Power BAT, battery Discharging (98.1% load, remaining time 4:04)
>
> where the numbers depend on the energy capacity of each battery and
> the current charge of each battery, as well as the actual current or
> power.
>
> That is what I think is crucial for M-x battery.

In that case I think the patch in https://debbugs.gnu.org/39491#55 fixes
the regression you observed by making the new default backend,
battery-upower, behave like the other multi-battery-aware backends in
this regard.

BTW, the reason battery-upower makes sense as a default is because the
UPower standard provides a uniform interface[6] over various system
interfaces such as the /sys/class/power_supply filesystem, and it also
supports asynchronous battery status change notifications which can be
used by battery.el to update its mode line string without polling.

[6]: https://xkcd.com/927/

HTH,

-- 
Basil



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

* RE: Support for multiple batteries
  2020-06-13  4:02   ` Richard Stallman
  2020-06-13 11:48     ` Basil L. Contovounesios
@ 2020-06-13 19:42     ` Drew Adams
  2020-06-14 13:43       ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2020-06-13 19:42 UTC (permalink / raw)
  To: rms, Basil L. Contovounesios; +Cc: emacs-devel

>   > AFAICT only two battery status backends currently support multiple
>   > sources of information: battery-linux-sysfs and battery-linux-proc-acpi,
>   > for Linux sysfs and ACPI support, respectively.
> 
> Could you clear up for me what "currently" means in this context?

Ohmm, "currently" in this context must have
something to do with E/R, no?  <ducks> ;-)



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

* Re: Support for multiple batteries
  2020-06-13 11:48     ` Basil L. Contovounesios
@ 2020-06-14 13:40       ` Richard Stallman
  2020-06-18 15:59         ` Basil L. Contovounesios
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2020-06-14 13:40 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  >   This can be perceived as a regression
  > on multi-battery systems because battery-upower currently assumes a
  > single battery, whereas the previous defaults of battery-status-function
  > on modern GNU/Linux systems (battery-linux-sysfs and
  > battery-linux-proc-acpi) support multiple batteries.  The patch in [5]
  > adds support for multiple batteries to battery-upower as well, so that
  > it can remain the default backend when applicable.

It sounds like that could make it work again for me.  Would you
please tell me when it is installed, so I can try it?

  > For example, they sum the current energy and energy-when-full of each
  > battery, and divide the former by the latter to get the combined load
  > percentage.

That sounds like the right thing for them to do.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-06-13 19:42     ` Drew Adams
@ 2020-06-14 13:43       ` Richard Stallman
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2020-06-14 13:43 UTC (permalink / raw)
  To: Drew Adams; +Cc: contovob, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Ohmm, "currently" in this context must have
  > something to do with E/R, no?  <ducks> ;-)

Cute.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

* Re: Support for multiple batteries
  2020-06-14 13:40       ` Richard Stallman
@ 2020-06-18 15:59         ` Basil L. Contovounesios
  0 siblings, 0 replies; 13+ messages in thread
From: Basil L. Contovounesios @ 2020-06-18 15:59 UTC (permalink / raw)
  To: Richard Stallman; +Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>   >   This can be perceived as a regression
>   > on multi-battery systems because battery-upower currently assumes a
>   > single battery, whereas the previous defaults of battery-status-function
>   > on modern GNU/Linux systems (battery-linux-sysfs and
>   > battery-linux-proc-acpi) support multiple batteries.  The patch in [5]
>   > adds support for multiple batteries to battery-upower as well, so that
>   > it can remain the default backend when applicable.
>
> It sounds like that could make it work again for me.  Would you
> please tell me when it is installed, so I can try it?

I have now installed the patch[1] for bug#39491 on master.  Please give
it your worst and let me know of any problems you encounter.

[1]: Improve battery.el UPower support
453d30d92c 2020-06-18 13:11:17 +0100
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=453d30d92cbf940567869d4705c1fcfe57725825

-- 
Basil



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

end of thread, other threads:[~2020-06-18 15:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27  3:38 Support for multiple batteries Richard Stallman
2020-02-28  7:43 ` Eli Zaretskii
2020-02-28 10:21   ` lg.zevlg
2020-02-28 12:57     ` Eli Zaretskii
2020-03-01  3:46     ` Richard Stallman
2020-03-03  3:37       ` Richard Stallman
2020-06-11 16:08 ` Basil L. Contovounesios
2020-06-13  4:02   ` Richard Stallman
2020-06-13 11:48     ` Basil L. Contovounesios
2020-06-14 13:40       ` Richard Stallman
2020-06-18 15:59         ` Basil L. Contovounesios
2020-06-13 19:42     ` Drew Adams
2020-06-14 13:43       ` Richard Stallman

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).