Re: [PATCH] ACPI: full battery charge cannot exceed current one

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

 



>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux