Bug 90975

Summary: Battery status is reported 'charging' when it is 'idling'/'unknown'
Product: upower Reporter: b3nmore
Component: generalAssignee: Richard Hughes <richard>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: b3nmore, elvis.angelaccio
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description b3nmore 2015-06-14 16:44:11 UTC
This is kind of a duplicate of #70321. But it seems to me, that primarily the wacom issue was solved, so I report the battery issue again, since the status isn't reported correctly after all.

For some batteries charge thresholds can be set (some thinkpad models and maybe others too). If plugged in and within the charge limits, the battery does not get charged but idles. It can bee seen as a fourth status besides 'charging', discharging', and 'full'.

The kernel reports 'unknown' in my case:
cat /sys/class/power_supply/BAT0/uevent 
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
POWER_SUPPLY_VOLTAGE_NOW=11631000
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=56160000
POWER_SUPPLY_ENERGY_FULL=55710000
POWER_SUPPLY_ENERGY_NOW=38680000
POWER_SUPPLY_CAPACITY=69
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=42T4653
POWER_SUPPLY_MANUFACTURER=LGC
POWER_SUPPLY_SERIAL_NUMBER=  292

But upower 0.99.3 reports 'charging':
upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               LGC
  model:                42T4653
  serial:               292
  power supply:         yes
  updated:              So 14 Jun 2015 18:32:01 CEST (16 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              38,68 Wh
    energy-empty:        0 Wh
    energy-full:         55,71 Wh
    energy-full-design:  56,16 Wh
    energy-rate:         0 W
    voltage:             11,631 V
    percentage:          69%
    capacity:            99,1987%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'

Shouldn't the 'unknown' status gets looped through so that userspace programs can react to it?
Comment 1 b3nmore 2015-06-16 10:00:19 UTC
Btw., when switching the battery status (e.g. discharging -> plugged in = idling due to charging thresholds) even more fields report wrong data.

upower:
state:               charging
energy-rate:         14,878 W
time to full:        49,8 minutes

kernel:
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_POWER_NOW=0

One gets the outputs in the previous post after booting in the 'idle' state.
Comment 2 Christian Stadelmann 2015-12-15 22:08:58 UTC
I second this "Plugged in" status is useful.

I am seeing this issue too on a Samsung laptop which limits battery percentage to 80% if enabled in BIOS.

$ cat /sys/class/power_supply/BAT1/uevent 
POWER_SUPPLY_NAME=BAT1
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
POWER_SUPPLY_VOLTAGE_NOW=12286000
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=4400000
POWER_SUPPLY_CHARGE_FULL=4200000
POWER_SUPPLY_CHARGE_NOW=3318000
POWER_SUPPLY_CAPACITY=79
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_MODEL_NAME=
POWER_SUPPLY_MANUFACTURER=SAMSUNG Electronics
POWER_SUPPLY_SERIAL_NUMBER=


$ upower -i /org/freedesktop/UPower/devices/battery_BAT1
  native-path:          BAT1
  vendor:               SAMSUNG Electronics
  power supply:         yes
  updated:              Di 15 Dez 2015 23:05:57 CET (30 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              36,8298 Wh
    energy-empty:        0 Wh
    energy-full:         46,62 Wh
    energy-full-design:  48,84 Wh
    energy-rate:         0,287206 W
    voltage:             12,286 V
    percentage:          79%
    capacity:            95,4545%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'
Comment 3 Elvis Angelaccio 2016-07-11 09:23:29 UTC
Same here on a Thinkpad X220:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SANYO
  model:                42T4940
  serial:               5388
  power supply:         yes
  updated:              lun 11 lug 2016 11:18:17 CEST (114 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              60,61 Wh
    energy-empty:        0 Wh
    energy-full:         67,72 Wh
    energy-full-design:  86,58 Wh
    energy-rate:         11,2781 W
    voltage:             12,391 V
    time to full:        37,8 minutes
    percentage:          89%
    capacity:            78,2167%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'


Battery status is 'charging', yet my battery already reached my 89% charging treshold.

kernel version: 4.6.3
upower version: 0.99.4
Comment 4 mlen 2016-11-05 13:57:34 UTC
Also happens on T460, kernel 4.8.6, upower 0.99.4
Comment 5 GitLab Migration User 2018-06-04 13:24:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/upower/upower/issues/35.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.