Subject: libbattery was Re: [RFC PATCH 5/5] power: generic-adc-battery: Add capacity handling

From: [email-masked] (Tony Lindgren)
Date: Thu, 19 Oct 2017 10:06:49 -0700

* H. Nikolaus Schaller <[email-masked]> [171019 09:57]:
> Hi Tony,
> 
> > Am 19.10.2017 um 18:24 schrieb Tony Lindgren <[email-masked]>:
> > 
> > * H. Nikolaus Schaller <[email-masked]> [171018 08:49]:
> >> 
> >>> Am 18.10.2017 um 15:22 schrieb Tony Lindgren <[email-masked]>:
> >>> 
> >>> * H. Nikolaus Schaller <[email-masked]> [171018 05:49]:
> >>>>> Am 18.10.2017 um 14:28 schrieb Pavel Machek <[email-masked]>:
> >>>>> 
> >>>>> So I started something, it is at.
> >>>>> 
> >>>>> https://github.com/pavelmachek/libbattery
> >>>>> 
> >>>>> My battery on n900 is currently uncalibrated (and charging), still it
> >>>>> gets some kind of estimation:
> >>>>> 
> >>>>> Battery -1 %
> >>>>> Seconds -1
> >>>>> State 1
> >>>>> Voltage 3.88 V
> >>>>> Battery 63 %
> >>>>> 
> >>>>> Of course, there's a lot more work to be done.
> >>>> 
> >>>> Nice start but not a solution to our problem.
> >>>> 
> >>>> Our problem is that people simply expect that for example https://packages.debian.org/wheezy/xfce/xfce4-battery-plugin
> >>>> displays the battery percentage.
> >>> 
> >>> I think we could make things compatible with various battery apps by
> >>> having libbattery write back the capacity percentage and time remaining
> >>> to the kernel driver via sysfs or a dev entry. Then the kernel interface
> >>> can just display the data to whatever apps.
> >> 
> >> Hm. That would be quite difficult to understand and maintain code.
> > 
> > How so? The libbattery can do it all, then the kernel drivers needing
> > that will just display the most recent values to maintain compability
> > with battery apps.
> 
> Well, it looks as if you are thinking about a much more complex solution
> than I am...
> 
> The proposal we are discussing as
> 
> [RFC PATCH 5/5] power: generic-adc-battery: Add capacity handling
> 
> just reads the current voltage, charging current and uses a (nonlinear)
> mapping to 0% .. 100%.

Right, I was discussing Pavel's libbattery link posted above. No
comments on the current patch series. Let's move the libbattery stuff
to a new thread to avoid confusion.

Regards,

Tony