From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: astarikovskiy@suse.de, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] battery: Fix charge_now returned by broken batteries
Date: Sun, 4 Oct 2009 19:46:42 +0200 [thread overview]
Message-ID: <ca2dc2820910041046i47a1c3dhba82266bb14a440c@mail.gmail.com> (raw)
In-Reply-To: <20091004164553.GD10505@khazad-dum.debian.net>
On Sun, Oct 4, 2009 at 6:45 PM, Henrique de Moraes Holschuh
<hmh@hmh.eng.br> wrote:
> On Sun, 04 Oct 2009, Miguel Ojeda wrote:
>> Some broken batteries like my DELL NR2227 or a friend's DELL GK4798 return
>> the design_capacity (charge_full_design) as capacity_now (charge_now)
>> when completely charged.
>>
>> I noticed this when looking at a battery plugin that reported "127% charged".
>> Some of these plugins have already "fixed" this in userspace by coding
>> something like min(percentage, 100)).
>
> A battery can be charged above 100%. It just depends what you call 100%,
> and the "I am full" level *varies* in a non-monotonic way during the battery
> lifetime...
>
> So, if you don't want to see > 100%, you have to clamp it to 100% and lose
> information (when your "100%" level is actually increasing as the thing
> keeps charging and you keep raising the baseline so that it doesn't go over
> 100%).
If the 100% level increased, then full_charge_capacity (a.k.a. "_last_
full capacity" as seen in /proc) will increase as well, won't it? If
the battery went over that 100% that means there is a "new" 100%, why
are we losing information?.
I am asking, I am not an expert on battery stuff.
>
>> So I discovered that the battery wrongly returns charge_full_design when
>> completely charged instead of charge_full.
>
> Ick.
>
>> This patch fixes this by returning min(capacity_now, full_charge_capacity)
>> on both procfs and sysfs.
>
> What will it cause on non-broken batteries? Or during gauge reset, when any
> battery that updates full_charge_capacity only at the end of the cycle will
> really have capacity_now > full_charge_capacity ?
Well, does it make sense to have capacity_now higher than
full_charge_capacity? Wouldn't that information be broken too?
Again, I am just wondering.
>
>> Now the userspace plugins report the correct 100% and their userspace check
>> may not be needed (if this error is the only one producing >100% results).
>
> Like I said, > 100% can happen, unless what you define to be 100% is very
> elastic (and gets updated all the time).
I still think it does not make sense to have a battery charged over
its 100% capacity whatever the definition of 100% is. Maybe I do not
understand your point.
>
> --
> "One disk to rule them all, One disk to find them. One disk to bring
> them all and in the darkness grind them. In the Land of Redmond
> where the shadows lie." -- The Silicon Valley Tarot
> Henrique Holschuh
>
next prev parent reply other threads:[~2009-10-04 17:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1254669853.26496.0.camel@carter>
2009-10-04 16:45 ` [PATCH] battery: Fix charge_now returned by broken batteries Henrique de Moraes Holschuh
2009-10-04 17:46 ` Miguel Ojeda [this message]
2009-10-04 18:57 ` Alexey Starikovskiy
2009-10-04 20:46 ` Rafael J. Wysocki
2009-10-04 21:36 ` Alexey Starikovskiy
2009-10-04 21:55 ` Miguel Ojeda
2009-10-04 22:38 ` Alexey Starikovskiy
2009-10-04 23:53 ` Miguel Ojeda
2009-10-05 0:18 ` Alexey Starikovskiy
2009-10-06 17:05 ` Miguel Ojeda
2009-10-10 12:04 ` Pavel Machek
2009-10-10 20:53 ` Miguel Ojeda
2009-10-10 21:25 ` Pavel Machek
2009-10-10 21:44 ` Miguel Ojeda
2009-10-10 22:49 ` Pavel Machek
2009-10-10 21:52 ` Henrique de Moraes Holschuh
2009-10-04 22:43 ` Rafael J. Wysocki
2009-10-04 22:56 ` Alexey Starikovskiy
2009-10-04 23:58 ` Miguel Ojeda
2009-10-04 21:42 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca2dc2820910041046i47a1c3dhba82266bb14a440c@mail.gmail.com \
--to=miguel.ojeda.sandonis@gmail.com \
--cc=astarikovskiy@suse.de \
--cc=hmh@hmh.eng.br \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox