Is upower misreporting battery capacity?

If I execute

upower --show-info /org/freedesktop/UPower/devices/battery_macsmc_battery

on my M2 air 13, I see among others, this line,

energy-full:         41.166 Wh

While the battery capacity is supposed to be 52.6 Wh according to specs. Is this a bug somewhere in upower?

I have had the same issue before on my Framework 13 (though not on Asahi).

For me it behaved like this:
The battery showed to be 100% charged (it was not). Battery health was reported as below 90% (the amount missing to full charge).

The laptop kept charging until the battery was at maximum capacity, with the health indicator moving along with the charge.

I am not sure how upower “knows” what battery health (and thus maximum capacity) is. It might have to see a full charge at least once before reporting accurately.

This is probably it. I have set battery to not charge past 80% and it hasn’t ever charged beyond that. And 52.6*0.8 = 42.1 which is pretty close to what upower is outputting. I see,

    energy:              32.688 Wh
    energy-empty:        0 Wh
    energy-full:         41.238 Wh
    energy-full-design:  41.067 Wh

so the problem does seem to be with normalization of total energy battery can hold.

It’s a bug/bad math in upower. The battery itself only reports the design capacity in amp hours. It also only reports a minimum voltage, but not a nominal voltage. upower is incorrectly multiplying these two together to arrive at power numbers.

For example, on the 14" M1 Pro:

POWER_SUPPLY_CAPACITY=80
POWER_SUPPLY_VOLTAGE_NOW=12202000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=9000000
POWER_SUPPLY_CHARGE_FULL_DESIGN=6075000
POWER_SUPPLY_CHARGE_FULL=5645000
POWER_SUPPLY_CHARGE_NOW=4448000

The spec says 70Wh while the battery reports 6.075 Ah design charge, which means the design voltage Apple used to calculate that number was around 11.5V. However, that number is not actually returned anywhere from the battery, so we don’t provide it.

upower instead reports:

energy-full-design: 54.675 Wh

Which is 6.075 Ah * 9V, which is a nonsensical calculation since the minimum battery voltage is not what you want, it’s the average.

The information in /sys/class/power_supply/macsmc-battery/ is the raw data from the battery. Anything else, upower is making up.

IMO upower should just stop trying to make up watt-hour numbers when the battery info is only in amp-hours. It’s misleading.

1 Like

upower isn’t responsible for that, it’s the BMC hardware. Looks like the BMC on your Framework was very confused as to the actual capacity of the battery when that happened. This is unrelated to our problem on Macs, which is just upower making up watt-hour numbers out of thin air with the wrong voltage.

The relation between design capacity and actual capacity should still be correct (and thus battery health as a %) here. It’s just the absolute watt-hour numbers that are wrong.

1 Like

Thank you for the info :slight_smile:

Thanks for explaining this!