Bug 1318845

Summary: Kernel 4.5 break upower - no correct value for battery supplied
Product: [Fedora] Fedora Reporter: Heiko Adams <bugzilla>
Component: kernelAssignee: Richard Hughes <rhughes>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 24CC: bugzilla, gansalmon, itamar, jonathan, kernel-maint, lsatenstein, madhu.chinakonda, mchehab, mschmidt, rhughes, richard
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-13 11:54:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
dmesg output from kernel 4.4
none
dmesg output from kernel 4.5 none

Description Heiko Adams 2016-03-18 01:19:01 UTC
Description of problem:
After upgrading from Fedora 23 upower doesn't show correct values vor battery anymore. It allways says the battery is fully charged even if the notebook is in battery mode for several minutes.

Version-Release number of selected component (if applicable):
$ rpm -q upower
upower-0.99.4-2.fc24.x86_64

How reproducible:
allways

Steps to Reproduce:
1. Unplug the notebook from powerline
2. wait a few minutes
3. run upower -i /org/freedesktop/UPower/devices/battery_BAT0

Actual results:
The output is allways
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  power supply:         yes
  updated:              Fr 18 Mär 2016 02:13:18 CET (91 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              0 Wh
    energy-empty:        0 Wh
    energy-full:         0 Wh
    energy-full-design:  0 Wh
    energy-rate:         0 W
    percentage:          100%
    capacity:            100%
    icon-name:          'battery-full-charged-symbolic'

Expected results:
upower should show correct values.

Additional info:

Comment 1 Heiko Adams 2016-03-18 17:46:58 UTC
This seems to be a problem with Kernel 4.5 because if I boot into Kernel 4.4.5 from Fedora 23 everything is fine.

BTW: Proposing this as a blocker because without a working battery info its hard to use Fedora 24 on a notebook.

Comment 2 Heiko Adams 2016-03-20 19:02:33 UTC
With kernel 4.4.5 the (correct) output is:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               PEGATRON
  model:                SP624
  power supply:         yes
  updated:              So 20 Mär 2016 19:57:19 CET (75 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              12,7095 Wh
    energy-empty:        0 Wh
    energy-full:         51,8925 Wh
    energy-full-design:  53,28 Wh
    energy-rate:         26,1738 W
    voltage:             11,789 V
    time to full:        1,5 hours
    percentage:          24%
    capacity:            97,3958%
    technology:          lithium-ion
    icon-name:          'battery-low-charging-symbolic'
  History (charge):
    1458500239	0,000	unknown
  History (rate):
    1458500239	0,000	unknown

Comment 3 Richard Hughes 2016-03-21 11:16:30 UTC
Why do you think this is a problem with upower and not the kernel? I'm assuming the values in /sys match the ones reported by upower, right?

Comment 4 Heiko Adams 2016-03-21 12:03:10 UTC
I already changed the component to "kernel". I don't know if the values in /sys are mathing the ones reported by upower because I don't know where to look in /sys for that values.

Comment 5 Michal Schmidt 2016-03-21 14:42:07 UTC
(In reply to Heiko Adams from comment #4)
Look in /sys/class/power_supply/.

Comment 6 Heiko Adams 2016-03-21 17:28:27 UTC
With Kernel 4.5 the files in /sys/class/power_supply/BAT0 are empty:

$ ls -lh /sys/class/power_supply/BAT0/
insgesamt 0
-rw-r--r--. 1 root root 4,0K 21. Mär 18:25 alarm
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 capacity
-r--r--r--. 1 root root 4,0K 21. Mär 18:25 capacity_level
-r--r--r--. 1 root root 4,0K 21. Mär 18:25 cycle_count
lrwxrwxrwx. 1 root root    0 21. Mär 18:25 device -> ../../../PNP0C0A:00
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 energy_full
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 energy_full_design
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 energy_now
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 manufacturer
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 model_name
drwxr-xr-x. 2 root root    0 21. Mär 18:25 power
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 power_now
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 present
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 serial_number
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 status
lrwxrwxrwx. 1 root root    0 21. Mär 18:07 subsystem -> ../../../../../../../class/power_supply
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 technology
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 type
-rw-r--r--. 1 root root 4,0K 21. Mär 18:07 uevent
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 voltage_min_design
-r--r--r--. 1 root root 4,0K 21. Mär 18:08 voltage_now

Comment 7 Michal Schmidt 2016-03-22 12:26:54 UTC
They cannot be all empty. Don't be misled by
> insgesamt 0

Please paste the output of this command on both kernels:
grep '' /sys/class/power_supply/BAT0/*

Comment 8 Heiko Adams 2016-03-22 17:52:10 UTC
Kernel 4.5:
$ grep '' /sys/class/power_supply/BAT0/*
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:100
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
grep: /sys/class/power_supply/BAT0/energy_full: No such device
grep: /sys/class/power_supply/BAT0/energy_full_design: No such device
grep: /sys/class/power_supply/BAT0/energy_now: No such device
/sys/class/power_supply/BAT0/manufacturer:
/sys/class/power_supply/BAT0/model_name:
grep: /sys/class/power_supply/BAT0/power: Is a directory
grep: /sys/class/power_supply/BAT0/power_now: No such device
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:
/sys/class/power_supply/BAT0/status:Unknown
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Unknown
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=100
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=
grep: /sys/class/power_supply/BAT0/voltage_min_design: No such device
grep: /sys/class/power_supply/BAT0/voltage_now: No such device

Comment 9 Heiko Adams 2016-03-22 18:00:35 UTC
Kernel 4.4.5:
$ grep '' /sys/class/power_supply/BAT0/*
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:12
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/charge_full:4338000
/sys/class/power_supply/BAT0/charge_full_design:4800000
/sys/class/power_supply/BAT0/charge_now:561000
/sys/class/power_supply/BAT0/current_now:2355000
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
/sys/class/power_supply/BAT0/manufacturer:PEGATRON
/sys/class/power_supply/BAT0/model_name:SP624
grep: /sys/class/power_supply/BAT0/power: Is a directory
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number: 
/sys/class/power_supply/BAT0/status:Charging
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Li-ion
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Charging
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=11478000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CURRENT_NOW=2355000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=4800000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=4338000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=561000
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=12
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=SP624
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=PEGATRON
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER= 
/sys/class/power_supply/BAT0/voltage_min_design:11100000
/sys/class/power_supply/BAT0/voltage_now:11478000

Comment 10 Heiko Adams 2016-04-03 20:46:15 UTC
Problem still exists with kernel-4.5.0-302.fc24

Comment 11 Heiko Adams 2016-04-15 17:04:10 UTC
$ uname -a
Linux Ostfriesland 4.5.1-300.fc24.x86_64 #1 SMP Tue Apr 12 18:55:06 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ grep '' /sys/class/power_supply/BAT0/*
/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:100
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/cycle_count:0
grep: /sys/class/power_supply/BAT0/device: Is a directory
grep: /sys/class/power_supply/BAT0/energy_full: No such device
grep: /sys/class/power_supply/BAT0/energy_full_design: No such device
grep: /sys/class/power_supply/BAT0/energy_now: No such device
/sys/class/power_supply/BAT0/manufacturer:
/sys/class/power_supply/BAT0/model_name:
grep: /sys/class/power_supply/BAT0/power: Is a directory
grep: /sys/class/power_supply/BAT0/power_now: No such device
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:
/sys/class/power_supply/BAT0/status:Unknown
grep: /sys/class/power_supply/BAT0/subsystem: Is a directory
/sys/class/power_supply/BAT0/technology:Unknown
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_NAME=BAT0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_STATUS=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_PRESENT=1
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Unknown
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CYCLE_COUNT=0
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY=100
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Normal
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MODEL_NAME=
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_MANUFACTURER=
/sys/class/power_supply/BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=
grep: /sys/class/power_supply/BAT0/voltage_min_design: No such device
grep: /sys/class/power_supply/BAT0/voltage_now: No such device

Comment 12 Michal Schmidt 2016-04-18 12:43:08 UTC
Do you have any "ACPI Exception:" errors in dmesg that you did not have with Linux 4.4? Please attach the complete dmesg output.

Comment 13 Heiko Adams 2016-04-18 14:05:28 UTC
Created attachment 1148222 [details]
dmesg output from kernel 4.4

Comment 14 Heiko Adams 2016-04-18 14:05:55 UTC
Created attachment 1148223 [details]
dmesg output from kernel 4.5

Comment 15 Heiko Adams 2016-05-13 11:54:02 UTC
Seems to be fixed with kernel 4.5.4-300

Comment 17 Leslie Satenstein 2016-07-09 13:27:59 UTC
Please refer to 1342533

Bug 1342533 - No UPS driver -- can't detect status of UPS Battery condition. 

This is not closed.  The bug is still a problem for F24

Check date.

Comment 18 Leslie Satenstein 2016-07-14 19:33:50 UTC
Not fixed yet