# Battery: last full capacity < remaining capacity

## JayCee

Hello,

I have a `problem' with my ACPI battery status. It shows a smaller `last full capacity' than the `remaining capacity':

```
jaycee@erebos > !600 > ~ $ cat /proc/acpi/battery/BAT0/info 

...

design capacity:         7800 mAh

last full capacity:      6821 mAh

...

jaycee@erebos > !601 > ~ $ cat /proc/acpi/battery/BAT0/state 

...

remaining capacity:      7800 mAh

...
```

That results in a battery charge of 114% in programs like KThinkBat. Is there a way to adjust the `last full capacity' value?

It's a Dell Latitude D620 Laptop with kernel 2.6.22.1.

Thanks and greets,

JayCee

----------

## Wormo

No way to reset it as far as I know. It needs to be dealt with in software via some sanity checks. You could try to get the apps fixed or switch to one that already handles this situation, e.g. wmbattery http://kitenet.net/~joey/code/wmbattery/news/version_2.30/ (click the link on that page to see the relevant changelog entry).

----------

## JayCee

That's a good idea! I think it should be easily possible to patch KThinkBat that it uses the designed capacity as reference value or something like this.

Thank you!

----------

## Anarcho

 *JayCee wrote:*   

> That's a good idea! I think it should be easily possible to patch KThinkBat that it uses the designed capacity as reference value or something like this.
> 
> Thank you!

 

But this would lead to wrong values for older batteries where the max. capacity is definitely lower than the design capacity.

It should make a sanity check on the percentages though, I think.

----------

## JayCee

Yes! I think so, too. But that shouldn't be a big problem. 

I will try to fix that this weekend and post the patch here.

----------

## JayCee

Here is the patch:

```
diff -ru kthinkbat-0.2.8/src/batinfobase.cpp kthinkbat-0.2.8-saint-check/src/batinfobase.cpp 

--- kthinkbat-0.2.8/src/batinfobase.cpp 2007-07-26 22:55:58.000000000 +0200 

+++ kthinkbat-0.2.8-saint-check/src/batinfobase.cpp     2007-12-14 13:48:23.000000000 +0100 

@@ -166,8 +166,15 @@ 

 BatInfoBase::getChargeLevel() { 

     float curFuel = getCurFuel(); 

     float lastFuel = getLastFuel(); 

-    if (curFuel >= 0 && lastFuel > 0) { 

+    float designFuel = getDesignFuel(); 

+ 

+    if (curFuel >= 0.0) { 

+      if (lastFuel >= 0.0 && lastFuel >= curFuel) { 

         return ( 100.0 / lastFuel ) * curFuel; 

+      } 

+      else if (designFuel >= 0.0 && designFuel >= curFuel) { 

+        return ( 100.0 / designFuel ) * curFuel; 

+      } 

     } 

     return -1; 

 }

```

----------

## Wormo

Have you submitted your patch back to thinkbat?

https://lepetitfou.dyndns.org/projects/kthinkbat/wiki/KThinkBatContribute

----------

## JayCee

Yes, I have wrote a mail directly to the author.

At the KThinkBat homepage I got an error, that I don't have the privileges to submit a patch  :Confused: 

----------

## Wormo

Ah, you have to create yourself an account and log in at the site first to submit patches. It helps cut down on spam...

https://lepetitfou.dyndns.org/projects/kthinkbat/register

----------

## JayCee

Okay, that's an argument! I've created myself an account and submitted a new ticket with my patch  :Smile: 

----------

