From: "Jan Včelák" <jan.vcelak@nic.cz>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: lenb@kernel.org, rjw@rjwysocki.net, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI: full battery charge cannot exceed current one
Date: Mon, 09 Dec 2013 23:25:15 +0100 [thread overview]
Message-ID: <52A6434B.9040100@nic.cz> (raw)
In-Reply-To: <20131209170214.GB30717@srcf.ucam.org>
>> Some degraded batteries report maximal capacity to be smaller than
>> current charge of the battery. This can confuse some user space
>> applications (like upower).
>
> Can't we just fix upower?
It looks like upower already resolved that:
http://cgit.freedesktop.org/upower/tree/src/linux/up-device-supply.c#n652
If the purpose of sysfs is to provide raw values retrieved from battery,
then I agree that this should not be handled in kernel.
Otherwise I would expect semantically correct data there.
>> + /* Some degraded batteries report lower full charge than current one. */
>> + if (battery->capacity_now > battery->full_charge_capacity)
>> + battery->full_charge_capacity = battery->capacity_now;
>> +
>
> Does upower read *_full on every read of the value? How do we guarantee
> that it won't read energy_now without updating energy_full and still
> come up with an incorrect calculation?
That's a good point. I'm not sure about other applications, but upower
always refreshes all values. Function up_device_supply_refresh_battery
seems to be the only place where 'charge_now' is being read:
http://cgit.freedesktop.org/upower/tree/src/linux/up-device-supply.c#n485
prev parent reply other threads:[~2013-12-09 22:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 12:36 [PATCH] ACPI: full battery charge cannot exceed current one Jan Vcelak
2013-12-09 17:02 ` Matthew Garrett
2013-12-09 22:25 ` Jan Včelák [this message]
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=52A6434B.9040100@nic.cz \
--to=jan.vcelak@nic.cz \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=rjw@rjwysocki.net \
/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;
as well as URLs for NNTP newsgroup(s).