[systemd-devel] udev "battery level changed" events

Martin Pitt martin.pitt at ubuntu.com
Wed Oct 23 14:28:12 CEST 2013


Bastien Nocera [2013-10-23 14:10 +0200]:
> I want to try and reduce wake-ups in UPower (some more), and wanted to
> disable polling of batteries when we have events sent for battery
> capacity changes.
> 
> Unfortunately, I don't have hardware that does this properly (my laptop
> only sends out events when the state transitions, not when the battery
> level changes).

My phone seems to do that. On charging:

| KERNEL[92.074140] change   /devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery (power_supply)
| ACTION=change
| DEVPATH=/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery
| POWER_SUPPLY_CAPACITY=38
| POWER_SUPPLY_CHARGE_EMPTY=147070
| POWER_SUPPLY_CHARGE_FULL=2101000
| POWER_SUPPLY_CHARGE_NOW=2102473
| POWER_SUPPLY_CHARGE_TYPE=Fast
| POWER_SUPPLY_CURRENT_NOW=-410000
| POWER_SUPPLY_HEALTH=Good
| POWER_SUPPLY_NAME=battery | POWER_SUPPLY_PRESENT=1
| POWER_SUPPLY_STATUS=Charging
| POWER_SUPPLY_TECHNOLOGY=Li-ion
| POWER_SUPPLY_TEMP=245
| POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4360000
| POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
| POWER_SUPPLY_VOLTAGE_NOW=3872145
| SEQNUM=4086
| SUBSYSTEM=power_supply
| 
| UDEV  [92.107882] change   /devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery (power_supply)
| ACTION=change
| DEVPATH=/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery
| POWER_SUPPLY_CAPACITY=38
| POWER_SUPPLY_CHARGE_EMPTY=147070
| POWER_SUPPLY_CHARGE_FULL=2101000
| POWER_SUPPLY_CHARGE_NOW=2102473
| POWER_SUPPLY_CHARGE_TYPE=Fast
| POWER_SUPPLY_CURRENT_NOW=-410000
| POWER_SUPPLY_HEALTH=Good
| POWER_SUPPLY_NAME=battery
| POWER_SUPPLY_PRESENT=1
| POWER_SUPPLY_STATUS=Charging
| POWER_SUPPLY_TECHNOLOGY=Li-ion
| POWER_SUPPLY_TEMP=245
| POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4360000
| POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
| POWER_SUPPLY_VOLTAGE_NOW=3872145
| SEQNUM=4086
| SUBSYSTEM=power_supply
| USEC_INITIALIZED=76247

On discharging:

| KERNEL[204.102065] change   /devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery (power_supply)
| ACTION=change
| DEVPATH=/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery
| POWER_SUPPLY_CAPACITY=38
| POWER_SUPPLY_CHARGE_EMPTY=83920
| POWER_SUPPLY_CHARGE_FULL=2098000
| POWER_SUPPLY_CHARGE_NOW=2105634
| POWER_SUPPLY_CHARGE_TYPE=N/A
| POWER_SUPPLY_CURRENT_NOW=226600
| POWER_SUPPLY_HEALTH=Good
| POWER_SUPPLY_NAME=battery
| POWER_SUPPLY_PRESENT=1
| POWER_SUPPLY_STATUS=Discharging
| POWER_SUPPLY_TECHNOLOGY=Li-ion
| POWER_SUPPLY_TEMP=228
| POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4360000
| POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
| POWER_SUPPLY_VOLTAGE_NOW=3750297
| SEQNUM=4129
| SUBSYSTEM=power_supply
| 
| UDEV  [204.150806] change   /devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery (power_supply)
| ACTION=change
| DEVPATH=/devices/platform/msm_ssbi.0/pm8921-core/pm8921-charger/power_supply/battery
| POWER_SUPPLY_CAPACITY=38
| POWER_SUPPLY_CHARGE_EMPTY=83920
| POWER_SUPPLY_CHARGE_FULL=2098000
| POWER_SUPPLY_CHARGE_NOW=2105634
| POWER_SUPPLY_CHARGE_TYPE=N/A
| POWER_SUPPLY_CURRENT_NOW=226600
| POWER_SUPPLY_HEALTH=Good
| POWER_SUPPLY_NAME=battery
| POWER_SUPPLY_PRESENT=1
| POWER_SUPPLY_STATUS=Discharging
| POWER_SUPPLY_TECHNOLOGY=Li-ion
| POWER_SUPPLY_TEMP=228
| POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4360000
| POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
| POWER_SUPPLY_VOLTAGE_NOW=3750297
| SEQNUM=4129
| SUBSYSTEM=power_supply
| USEC_INITIALIZED=4104080

I get about one uevent in 10 seconds during discharging, and about one
per second during charging. So using uevents for the latter won't help
much for reducing wakeups, but I take it it doesn't matter that much
while an AC is attached.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list