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
Attachment:
signature.asc
Description: OpenPGP digital signature