Understanding the output of /sys/class/power_supply/BAT0/uevent

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

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

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like