Skip to content
Commit 2949136b authored by Philipp Zabel's avatar Philipp Zabel
Browse files

linux: Fix < 0.01 W energy-rate readings from power_now sysfs property

Currently, if a power supplies' power_now sysfs file reports discharge
rates < 0.01 W, the code will try to calculate the discharge rate from
the legacy sysfs files. On new kernels where those don't exist, this
produces wrong results.

For example, on a dual-battery Thinkpad T450s, while the external
battery is discharging, the internal battery reports power_now = 0,
but the corresponding upower energy-rate field incorrectly reads
about 2.3 W.

This patch fixes the issue by falling back to the legacy code only if
the legacy current_now sysfs file exists.

Closes: #7, #44
parent 0f2837ac
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment