Subject: Re: bug#39491: 28.0.50; two bugs in battery-upower

From: [email-masked]
Date: Sat, 8 Feb 2020 12:10:46 +0400

> 8 февр. 2020 г., в 11:31, Eli Zaretskii <[email-masked]> написал(а):
> 
> 
>> 
>> From: Richard Stallman <[email-masked]>
>> Date: Fri, 07 Feb 2020 15:14:57 -0500
>> 
>> 
>> battery-upower crashes on my laptop because there is no BatteryLevel property.
>> This code
>> 
>>          (cons ?b (cond ((= level 3) "-")
>>                         ((= level 4) "!")
>>                         (online-p "+")
>>                         (t "")))
>> 
>> needs to handle nil.  I don't know what value it should return for that case.
>> 

If level is unavailable and AC is off-line/unknown, then it should be empty string I think.  User could see the battery level is low/critical by percentage

>> However, that function has a design flaw: it reports on just the first
>> battery in the list.  battery-upower-device-list correctly returns a
>> list with an element for each battery, but battery-upower finds only one
>> of them (the first one in the list) and ignores the others.
>> 
>> The old code handle all the batteries and added the energy quantities
>> so as to report accurately the total power available and overall
>> fraction of charge.  I wrote that code myself, around 10 years ago.
>> 
>> Please restore the lost functionality.
> 
> Evgeny, could you please look into fixing this?
> 

OK, we should generalize multi-battery code then, so each status func won’t reimplement multi battery handling.

I’ll look at it tomorrow

> TIA