author | Peter Wu <peter@lekensteyn.nl> | |
Mon, 30 Mar 2015 16:48:06 +0000 (18:48 +0200) | ||
committer | Peter Wu <peter@lekensteyn.nl> | |
Mon, 30 Mar 2015 16:48:06 +0000 (18:48 +0200) | ||
commit | af5eb0ca07aac94bf4ebf5429e9d5c2c1fb7d4e9 | |
tree | 3b6803186e01ae215749f5e7ec9a52ddcae044a2 | tree | snapshot |
parent | f03005bd330f0c060025aef8b6fcac1bc55a3ca5 | commit | diff |
battery: report current if known
The power field is not always available (take my Clevo B7130 laptop for
example). The current is reported though via "current_now".
According to the ACPI spec v5.0, sect. 10.2.2.6 _BST (Battery Status),
the reported field is "battery present rate" which is always positive
(its direction depends on the charging state).
Contents of /sys/class/power_supply/BAT0/uevent for my laptop:
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=11824000
POWER_SUPPLY_CURRENT_NOW=1498000
POWER_SUPPLY_CHARGE_FULL_DESIGN=5200000
POWER_SUPPLY_CHARGE_FULL=5280000
POWER_SUPPLY_CHARGE_NOW=4797000
POWER_SUPPLY_CAPACITY=90
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=BAT
POWER_SUPPLY_MANUFACTURER=NOTEBOOK
POWER_SUPPLY_SERIAL_NUMBER=0001
Note for Clevo B7130 owners, the charging rate is not reported when
discharging but this can be [patched][1].
[1]: https://github.com/Lekensteyn/acpi-stuff/blob/master/Clevo-B7130/BatteryFix.dsl
The power field is not always available (take my Clevo B7130 laptop for
example). The current is reported though via "current_now".
According to the ACPI spec v5.0, sect. 10.2.2.6 _BST (Battery Status),
the reported field is "battery present rate" which is always positive
(its direction depends on the charging state).
Contents of /sys/class/power_supply/BAT0/uevent for my laptop:
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=11824000
POWER_SUPPLY_CURRENT_NOW=1498000
POWER_SUPPLY_CHARGE_FULL_DESIGN=5200000
POWER_SUPPLY_CHARGE_FULL=5280000
POWER_SUPPLY_CHARGE_NOW=4797000
POWER_SUPPLY_CAPACITY=90
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=BAT
POWER_SUPPLY_MANUFACTURER=NOTEBOOK
POWER_SUPPLY_SERIAL_NUMBER=0001
Note for Clevo B7130 owners, the charging rate is not reported when
discharging but this can be [patched][1].
[1]: https://github.com/Lekensteyn/acpi-stuff/blob/master/Clevo-B7130/BatteryFix.dsl
src/battery.c | diff | blob | history |