7

Ubuntu shows the remaining battery time on my desktop as ~2 hours.

I was trying to arrive at this same value from /sys/class/power_supply/BAT0/uevent. The output of cat /sys/class/power_supply/BAT0/uevent for that instant:

POWER_SUPPLY_NAME=BAT0  
POWER_SUPPLY_STATUS=Discharging  
POWER_SUPPLY_PRESENT=1  
POWER_SUPPLY_TECHNOLOGY=Li-ion  
POWER_SUPPLY_CYCLE_COUNT=481  
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=7400000  
POWER_SUPPLY_VOLTAGE_NOW=7400000  
POWER_SUPPLY_POWER_NOW=9361000  
POWER_SUPPLY_ENERGY_FULL_DESIGN=48248000  
POWER_SUPPLY_ENERGY_FULL=40877000  
POWER_SUPPLY_ENERGY_NOW=20712000  
POWER_SUPPLY_CAPACITY=50  
POWER_SUPPLY_MODEL_NAME=UX32-65  
POWER_SUPPLY_MANUFACTURER=ASUSTeK  
POWER_SUPPLY_SERIAL_NUMBER=   

I was assuming the POWER_SUPPLY_ENERGY_NOW value would be in Watt. How do I work out the remaining battery time from this?

1

1 Answer 1

8

Power now = 9.361W, energy now = 20.712Wh. Remaining time is 20.712 / 9.361 which is approximately two hours.

4
  • You are implying that these fixed point numbers are Watts (and other engineering units), as opposed to raw A/D counts (for example). Is it a conjecture? Is there a reference that covers this? Aug 31, 2014 at 16:22
  • @NickAlexeev ACPI documentation states both \$\mathrm{W}\$ and \$\mathrm{A}\$ can be used. And \$48\, \mathrm{Ah}\$ laptop battery is implausible.
    – venny
    Aug 31, 2014 at 16:49
  • @NickAlexeev - Providing the units for power and energy are consistent, then they can cancel, leaving hours as the only surviving dimension. (Irritating that the ACPI document is word, grrr :-)
    – gbulmer
    Aug 31, 2014 at 17:41
  • 2
    A probably more current documentation for units: kernel.org/doc/html/latest/power/power_supply_class.html : “Quoting include/linux/power_supply.h: All voltages, currents, charges, energies, time and temperatures in µV, µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise stated. It’s driver’s job to convert its raw values to units in which this class operates.”
    – tzot
    Mar 11, 2021 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .