current_now may contain useful negative rates while discharging
Submitted by xfc..@..huh.de
Assigned to Xfce-Goodies Maintainers
Description
Some battery drivers are reporting a negative rate in /sys/class/power_supply/BAT0/current_now (replace BAT0 with your battery) such as the bq27x00-battery driver and the kernel for the toshiba ac100 (tegra 2 soc). In the two cases, the current_now contains a useful rate (i.e. no error code).
A negative rate in current_now however, is interpreted by the xfce4-battery-plugin as an error such that remaining time is not displayed correctly.
This could be fixed by adding abs() panel-plugin/libacpi.c around line 793 together with considering the value -1000 as a not present rate.
The upower-daemon, for instance, also applies abs() to this value.
AFAIK, the acpi specification does not allow negative rates but int the linux power supply class documentation, there seems to be currently no statement about the sign.