Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #181528

Re: Issue with notebook (maybe the battery?)

From Daniel Bareiro <daniel-listas@gmx.net>
Newsgroups linux.debian.user
Subject Re: Issue with notebook (maybe the battery?)
Date 2017-05-28 03:00 +0200
Message-ID <tLUIN-30H-3@gated-at.bofh.it> (permalink)
References (6 earlier) <tq4Yy-3SP-23@gated-at.bofh.it> <tKEd4-2Lr-31@gated-at.bofh.it> <tKOP8-TD-3@gated-at.bofh.it> <tKPi9-14X-7@gated-at.bofh.it> <tKPLb-1uq-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi, David.

On 24/05/17 22:23, David Wright wrote:

>> When you talk about "the numbers", do you mean to see by the console the
>> values that are obtained for both batteries (voltage, for example) to
>> make a comparison?

> Yes, the bash function I use is:
> 
> battery () 
> { 
>     local BATTERYFILE="/sys/class/power_supply/BAT0/uevent";
>     [ ! -r $BATTERYFILE ] && printf '%s\n' "$BATTERYFILE not found!" && return 1;
>     date +%Y-%m-%d-%H-%M-%S;
>     cat $BATTERYFILE;
>     local FILEBATNOW="/sys/class/power_supply/BAT0/charge_now";
>     local FILEBATPREV="/sys/class/power_supply/BAT0/charge_full";
>     local CHARGE=$(( 100 * $(< $FILEBATNOW) / $(< $FILEBATPREV) ));
>     [ $CHARGE -lt 100 ] && printf '%s\n' "Charge: $CHARGE%"
> }

Interesting... thanks for sharing :-)

I had to modify it because in my case I don't have "BAT0/charge_full"
and "BAT0/charge_now". I have "BAT0/energy_now" and "BAT0/energy_full".
Maybe you're using Stretch or a Backports kernel?

> AIUI uevent gives you the lot, which varies by model etc.
> so just   cat /sys/class/power_supply/BAT0/uevent
> should do it, with and without the power supply connected.

Sending the values to a file, I then graphed them using GNUPlot. A
picture tells more than thousands of words :-) It is interesting to see
how the charging curve describes almost a perfect straight line
and then begins to decelerate as it approaches 100%.

https://ibin.co/3Ny1TPsm9oNn.png

> (I run a slightly more sophisticated version that also
> reads the CPU temperature, has error trapping, and changes
> the root window colour according to battery state and,
> if frying, temperature.)

It would be interesting to see it :-)


Kind regards,
Daniel

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Issue with notebook (maybe the battery?) Daniel Bareiro <daniel-listas@gmx.net> - 2017-05-24 15:10 +0200
  Re: Issue with notebook (maybe the battery?) Fungi4All <fungilife@protonmail.com> - 2017-05-24 17:20 +0200
    Re: Issue with notebook (maybe the battery?) David Wright <deblis@lionunicorn.co.uk> - 2017-05-25 03:00 +0200
  Re: Issue with notebook (maybe the battery?) David Wright <deblis@lionunicorn.co.uk> - 2017-05-25 02:30 +0200
    Re: Issue with notebook (maybe the battery?) Daniel Bareiro <daniel-listas@gmx.net> - 2017-05-25 03:00 +0200
      Re: Issue with notebook (maybe the battery?) David Wright <deblis@lionunicorn.co.uk> - 2017-05-25 03:30 +0200
        Re: Issue with notebook (maybe the battery?) Daniel Bareiro <daniel-listas@gmx.net> - 2017-05-28 03:00 +0200
          Re: Issue with notebook (maybe the battery?) David Wright <deblis@lionunicorn.co.uk> - 2017-06-02 21:40 +0200

csiph-web