unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* battery.el broken?
@ 2021-06-05 13:55 T.V Raman
  2021-06-05 22:21 ` Basil L. Contovounesios
  2021-06-26  2:01 ` T.V Raman
  0 siblings, 2 replies; 8+ messages in thread
From: T.V Raman @ 2021-06-05 13:55 UTC (permalink / raw)
  To: emacs-devel

Used to display battery percentage and time left; now says

Power on-line, battery discharging (93% load, remaining time 0:00)


-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



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

* Re: battery.el broken?
  2021-06-05 13:55 battery.el broken? T.V Raman
@ 2021-06-05 22:21 ` Basil L. Contovounesios
  2021-06-05 22:23   ` Stefan Monnier
  2021-06-26  2:01 ` T.V Raman
  1 sibling, 1 reply; 8+ messages in thread
From: Basil L. Contovounesios @ 2021-06-05 22:21 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> Used to display battery percentage and time left; now says
>
> Power on-line, battery discharging (93% load, remaining time 0:00)

The default output format of 'M-x battery' has barely changed across
several Emacs versions (though different battery-status-function
backends call things by different names, e.g. AC vs on-line).

So I'm guessing the "broken" part is the contradiction between on-line
and discharging, and the zero remaining time to full/empty.

If so, please say which Emacs version you're running and what your value
of battery-status-function is.

If you're on Emacs 28 with battery-upower, you can see all the
information returned by the system UPower daemon by evaluating:

  (mapcar #'battery--upower-device-properties
          (battery--upower-devices))

The returned alists will include relevant keys such as Online, State,
TimeToEmpty, and TimeToFull, all of which are documented at
https://upower.freedesktop.org/docs/Device.html.

If the returned alists are internally inconsistent, then it's not Emacs'
fault.

If they look fine but the result of the battery-upower function
disagrees with them, then there's an Emacs bug in the translation,
indeed.

Feel free to post the relevant data here for help with deciphering it.
(Excluding the Vendor, Model, and Serial properties I guess, in case
they're considered sensitive?  I have no idea.)

HTH,

-- 
Basil



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

* Re: battery.el broken?
  2021-06-05 22:21 ` Basil L. Contovounesios
@ 2021-06-05 22:23   ` Stefan Monnier
  2021-06-06  1:52     ` T.V Raman
  2021-06-06  1:58     ` T.V Raman
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2021-06-05 22:23 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: T.V Raman, emacs-devel

> If so, please say which Emacs version you're running and what your value
> of battery-status-function is.

You might also want to try using another of those
battery-status-functions to see if that helps.


        Stefan




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

* Re: battery.el broken?
  2021-06-05 22:23   ` Stefan Monnier
@ 2021-06-06  1:52     ` T.V Raman
  2021-06-11 10:51       ` Basil L. Contovounesios
  2021-06-06  1:58     ` T.V Raman
  1 sibling, 1 reply; 8+ messages in thread
From: T.V Raman @ 2021-06-06  1:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1942 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

I am mostly convinced this is a dbus/upower bug since I too checked and
nothing has changed on the Emacs side  on the machine, still running
Emacs from Github@HEAD.

Will now try some of the other status functions, I think the output
stopped telling me time left likely a couple of days ago.

Typing this with the machine fully charged and not plugged into the AC
jack, but the upower output shown below appears to think it's on AC
Power.

battery-status-function == battery-upower

(mapcar #'battery--upower-device-properties
(battery--upower-devices)
)

((("NativePath" . "AC") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "BAT0") ("Vendor" . "SMP") ("Model" . "01AV431") ("Serial" . "5195") ("UpdateTime" . 1622944181) ("Type" . 2) ("PowerSupply" . t) ("HasHistory" . t) ("HasStatistics" . t) ("Online") ("Energy" . 51.36) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:001") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online" . t) ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:002") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943940) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...))


>> If so, please say which Emacs version you're running and what your value
>> of battery-status-function is.
>
> You might also want to try using another of those
> battery-status-functions to see if that helps.
>
>
>         Stefan
>
>

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8



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

* Re: battery.el broken?
  2021-06-05 22:23   ` Stefan Monnier
  2021-06-06  1:52     ` T.V Raman
@ 2021-06-06  1:58     ` T.V Raman
  1 sibling, 0 replies; 8+ messages in thread
From: T.V Raman @ 2021-06-06  1:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 2330 bytes --]

And on the same machine a few mins later:

(setq battery-status-function #'battery-linux-sysfs)
M-x battery displays the time left:
Power BAT, battery Discharging (98.7% load, remaining time 10:48)
(battery-linux-sysfs)
((99 . "4110066.461338953") (114 . "4.9") (109 . "624") (104 . "10") (116 . "10:24") (100 . "N/A") (66 . "Discharging") (98 . "") (112 . "98.7") (76 . "BAT"))

Stefan Monnier <monnier@iro.umontreal.ca> writes:

I am mostly convinced this is a dbus/upower bug since I too checked and
nothing has changed on the Emacs side  on the machine, still running
Emacs from Github@HEAD.

Will now try some of the other status functions, I think the output
stopped telling me time left likely a couple of days ago.

Typing this with the machine fully charged and not plugged into the AC
jack, but the upower output shown below appears to think it's on AC
Power.

battery-status-function == battery-upower

(mapcar #'battery--upower-device-properties
(battery--upower-devices)
)

((("NativePath" . "AC") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "BAT0") ("Vendor" . "SMP") ("Model" . "01AV431") ("Serial" . "5195") ("UpdateTime" . 1622944181) ("Type" . 2) ("PowerSupply" . t) ("HasHistory" . t) ("HasStatistics" . t) ("Online") ("Energy" . 51.36) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:001") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online" . t) ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:002") ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943940) ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...))


>> If so, please say which Emacs version you're running and what your value
>> of battery-status-function is.
>
> You might also want to try using another of those
> battery-status-functions to see if that helps.
>
>
>         Stefan
>
>

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8



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

* Re: battery.el broken?
  2021-06-06  1:52     ` T.V Raman
@ 2021-06-11 10:51       ` Basil L. Contovounesios
  2021-06-11 14:30         ` T.V Raman
  0 siblings, 1 reply; 8+ messages in thread
From: Basil L. Contovounesios @ 2021-06-11 10:51 UTC (permalink / raw)
  To: T.V Raman; +Cc: Stefan Monnier, emacs-devel

"T.V Raman" <raman@google.com> writes:

> I am mostly convinced this is a dbus/upower bug since I too checked and
> nothing has changed on the Emacs side  on the machine, still running
> Emacs from Github@HEAD.
>
> Will now try some of the other status functions, I think the output
> stopped telling me time left likely a couple of days ago.
>
> Typing this with the machine fully charged and not plugged into the AC
> jack, but the upower output shown below appears to think it's on AC
> Power.
>
> battery-status-function == battery-upower
>
> (mapcar #'battery--upower-device-properties
> (battery--upower-devices)
> )
>
> ((("NativePath" . "AC") ("Vendor" . "") ("Model" . "") ("Serial" . "")
> ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory")
> ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...)
> (("NativePath" . "BAT0") ("Vendor" . "SMP") ("Model" . "01AV431") ("Serial"
> . "5195") ("UpdateTime" . 1622944181) ("Type" . 2) ("PowerSupply" . t)
> ("HasHistory" . t) ("HasStatistics" . t) ("Online") ("Energy" . 51.36)
> ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:001")
> ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939)
> ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online" . t)
> ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath"
> . "ucsi-source-psy-USBC000:002") ("Vendor" . "") ("Model" . "") ("Serial" . "")
> ("UpdateTime" . 1622943940) ("Type" . 1) ("PowerSupply" . t) ("HasHistory")
> ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...))

Hm, did you always have those ucsi-source-psy entries?  Searching for
them online led me to the following relatively recent discussions on
USB-C power sources, UPower, and Linux:

https://forum.manjaro.org/t/upowerd-not-recognising-usb-c-path-charger-is-usb-c
https://gitlab.freedesktop.org/upower/upower/-/issues/126
https://bugs.launchpad.net/ubuntu/+source/upower/+bug/1891799

In particular I notice that the first of the two ucsi-source-psy entries
says ("Online" . t), which seems contradictory and is probably what
throws battery-upower off.

-- 
Basil



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

* Re: battery.el broken?
  2021-06-11 10:51       ` Basil L. Contovounesios
@ 2021-06-11 14:30         ` T.V Raman
  0 siblings, 0 replies; 8+ messages in thread
From: T.V Raman @ 2021-06-11 14:30 UTC (permalink / raw)
  To: contovob; +Cc: raman, monnier, emacs-devel

yes, looks like some upower dbus  bug; separatley, for the longest
time the dbus api has been reporting AC power connect/disconnect
*much* after the event.
It's pretty broken, and not Emacs' fault.

the upower commandline utility gives the right value by the way

Basil L. Contovounesios writes:
 > "T.V Raman" <raman@google.com> writes:
 > 
 > > I am mostly convinced this is a dbus/upower bug since I too checked and
 > > nothing has changed on the Emacs side  on the machine, still running
 > > Emacs from Github@HEAD.
 > >
 > > Will now try some of the other status functions, I think the output
 > > stopped telling me time left likely a couple of days ago.
 > >
 > > Typing this with the machine fully charged and not plugged into the AC
 > > jack, but the upower output shown below appears to think it's on AC
 > > Power.
 > >
 > > battery-status-function == battery-upower
 > >
 > > (mapcar #'battery--upower-device-properties
 > > (battery--upower-devices)
 > > )
 > >
 > > ((("NativePath" . "AC") ("Vendor" . "") ("Model" . "") ("Serial" . "")
 > > ("UpdateTime" . 1622943939) ("Type" . 1) ("PowerSupply" . t) ("HasHistory")
 > > ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...)
 > > (("NativePath" . "BAT0") ("Vendor" . "SMP") ("Model" . "01AV431") ("Serial"
 > > . "5195") ("UpdateTime" . 1622944181) ("Type" . 2) ("PowerSupply" . t)
 > > ("HasHistory" . t) ("HasStatistics" . t) ("Online") ("Energy" . 51.36)
 > > ("EnergyEmpty" . 0.0) ...) (("NativePath" . "ucsi-source-psy-USBC000:001")
 > > ("Vendor" . "") ("Model" . "") ("Serial" . "") ("UpdateTime" . 1622943939)
 > > ("Type" . 1) ("PowerSupply" . t) ("HasHistory") ("HasStatistics") ("Online" . t)
 > > ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...) (("NativePath"
 > > . "ucsi-source-psy-USBC000:002") ("Vendor" . "") ("Model" . "") ("Serial" . "")
 > > ("UpdateTime" . 1622943940) ("Type" . 1) ("PowerSupply" . t) ("HasHistory")
 > > ("HasStatistics") ("Online") ("Energy" . 0.0) ("EnergyEmpty" . 0.0) ...))
 > 
 > Hm, did you always have those ucsi-source-psy entries?  Searching for
 > them online led me to the following relatively recent discussions on
 > USB-C power sources, UPower, and Linux:
 > 
 > https://forum.manjaro.org/t/upowerd-not-recognising-usb-c-path-charger-is-usb-c
 > https://gitlab.freedesktop.org/upower/upower/-/issues/126
 > https://bugs.launchpad.net/ubuntu/+source/upower/+bug/1891799
 > 
 > In particular I notice that the first of the two ucsi-source-psy entries
 > says ("Online" . t), which seems contradictory and is probably what
 > throws battery-upower off.
 > 
 > -- 
 > Basil

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



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

* Re: battery.el broken?
  2021-06-05 13:55 battery.el broken? T.V Raman
  2021-06-05 22:21 ` Basil L. Contovounesios
@ 2021-06-26  2:01 ` T.V Raman
  1 sibling, 0 replies; 8+ messages in thread
From: T.V Raman @ 2021-06-26  2:01 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 548 bytes --]

"T.V Raman" <raman@google.com> writes:

Following up to myself --- in the spirit of "Eventually, everything
converges to Windows": a reboot fixed the battery status I reported
--sigh!


> Used to display battery percentage and time left; now says
>
> Power on-line, battery discharging (93% load, remaining time 0:00)
>
>
> -- 
>
> Thanks,
>
> --Raman(I Search, I Find, I Misplace, I Research)
> 7©4 Id: kg:/m/0285kf1  •0Ü8

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8



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

end of thread, other threads:[~2021-06-26  2:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-05 13:55 battery.el broken? T.V Raman
2021-06-05 22:21 ` Basil L. Contovounesios
2021-06-05 22:23   ` Stefan Monnier
2021-06-06  1:52     ` T.V Raman
2021-06-11 10:51       ` Basil L. Contovounesios
2021-06-11 14:30         ` T.V Raman
2021-06-06  1:58     ` T.V Raman
2021-06-26  2:01 ` T.V Raman

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