[Bug 215531] Lenovo charge limit feature stops 1% short of the configured limit and says it's still charging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=215531

--- Comment #3 from Hans de Goede (jwrdegoede@xxxxxxxxxxxxxxxxx) ---
(In reply to Nate Graham from comment #2)
> > the capacity in % being more or less equal to the
> > charge_control_end_threshold(1) value
> 
> Does this mean that expect userspace software to say, "79% is close enough
> to 80%, consider them equal"?

If necessary, yes. It also depends where the 79% is coming from.

On my X1 carbon gen 8, there is both a "capacity" file as well as "energy_now"
and "energy_full" files under /sys/class/power_supply/BAT0. IIRC upower prefers
the "energy_now" and "energy_full" files and then calculates a % based on these
itself.

It is possible that when the system stops charging
/sys/class/power_supply/BAT0/capacity actually is 80% where as the calculation
of the % from:

energy_now * 100 / energy_full

Results in 79% especially if that divide is down without rounding the result to
the nearest whole percent (by default integer division in C rounds down).

So it might be better if for the "full" because of hitting the charge threshold
case the check uses /sys/class/power_supply/BAT0/capacity rather then
energy_now, this will all need to be tested as this gets implemented and will
likely need some more tweaking while the feature has just landed.

Things like the above example can all lead to things looking to be 1% or
sometimes even 2% of, so yes userspace will be expected to fuzz things a bit
here if necessary.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux