You are not logged in.

#1 2013-07-25 08:37:44

OdinEidolon
Member
From: Belluno - Italy
Registered: 2011-01-31
Posts: 498

Looking for CLI Battery info utility (+ rate information problem)

Hi all,
I'm looking for some simple CLI tool to give some battery information.
With battery info, I mean current power rate, available Wh, design Wh, last Wh when full.

acpi can provide only partial information on my system.

acpi -bi
Battery 0: Discharging, 83%, rate information unavailable
Battery 0: design capacity 4400 mAh, last full capacity 2607 mAh = 59%

For some reason neither acpi not powertop can read the power rate of my system. (yes, I calibrated powertop)
However, the "gnome-power-statistics" GUI tool (gnome-power-manager package in extra) can indeed provide this info, as can the "wattson" plasmoid (kdeplasma-applets-wattson in AUR). I do not know how these obtain rate information and if they are any good.

I have no /proc/acpi/battery folder, but of course I have /sys/class/power_supply/BAT0/.
So I can get the info manually:

cat /sys/class/power_supply/BAT0/charge_now

However,

cat /sys/class/power_supply/BAT0/current_now 
cat: /sys/class/power_supply/BAT0/current_now: No such device

Any idea?

Last edited by OdinEidolon (2013-07-25 08:38:33)


Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee

Offline

#2 2013-07-25 09:42:03

aesiris
Member
Registered: 2012-02-25
Posts: 97

Re: Looking for CLI Battery info utility (+ rate information problem)

upower is a cli utility that can read those parameters, but I don't know which API it uses.

Offline

#3 2013-07-25 10:38:40

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: Looking for CLI Battery info utility (+ rate information problem)

Do you have a uevent file in the /sys/class/power_supply/BAT0/ directory? Here, that file has all the info from the other files in that directory conveniently located. I used to grep that file for info, now I have a little c program that pops up a window telling me to unplug/plug in the ac.


You're just jealous because the voices only talk to me.

Offline

#4 2013-07-25 10:41:04

OdinEidolon
Member
From: Belluno - Italy
Registered: 2011-01-31
Posts: 498

Re: Looking for CLI Battery info utility (+ rate information problem)

aesiris wrote:

upower is a cli utility that can read those parameters, but I don't know which API it uses.

Thank you, I did not think of using upower.
And it does indeed show the rate!

Now, how does it calculate it? (I don't have time to look for it now, but I will tomorrow) I think it does just make the (numerical) derivative of the battery energy over time.
But why isn't rate it shown in /sys/class?


Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee

Offline

#5 2013-07-25 10:46:12

OdinEidolon
Member
From: Belluno - Italy
Registered: 2011-01-31
Posts: 498

Re: Looking for CLI Battery info utility (+ rate information problem)

moetunes wrote:

Do you have a uevent file in the /sys/class/power_supply/BAT0/ directory? Here, that file has all the info from the other files in that directory conveniently located. I used to grep that file for info, now I have a little c program that pops up a window telling me to unplug/plug in the ac.

Thanks for that, yes I have it but does not show the rate. However, it is very useful for writing scripts.


Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee

Offline

Board footer

Powered by FluxBB