Bug 9957

Summary: Battery gives me now two batterys, but only one is present
Product: ACPI Reporter: Patrick Matthäi (patrick)
Component: Power-BatteryAssignee: Zhang Rui (rui.zhang)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: acpi-bugzilla, bunk
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.24.2 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 9243    
Attachments: My Kernel config
ACPIDUMP

Description Patrick Matthäi 2008-02-13 12:00:10 UTC
Latest working kernel version: 2.6.23.14
Earliest failing kernel version: 2.6.24
Distribution: Debian Sid
Hardware Environment: Notebook => HP Compaq 6715s
Software Environment: kpowersave
Problem Description:

Hello,
I noticed today, that kpowersave shows me, that I've got two batterys in my laptop, with the same capacity, but this isn't true.

Only one battery is connected to my system and here are some informations:

me@gnu:~$ grep -r '' /proc/acpi/battery/*
/proc/acpi/battery/C1EC/alarm:present:                 no
/proc/acpi/battery/C1EC/state:present:                 no
/proc/acpi/battery/C1EC/info:present:                 no
/proc/acpi/battery/C1ED/alarm:alarm:                   unsupported
/proc/acpi/battery/C1ED/state:present:                 yes
/proc/acpi/battery/C1ED/state:capacity state:          ok
/proc/acpi/battery/C1ED/state:charging state:          charging
/proc/acpi/battery/C1ED/state:present rate:            3002 mA
/proc/acpi/battery/C1ED/state:remaining capacity:      1608 mAh
/proc/acpi/battery/C1ED/state:present voltage:         12232 mV
/proc/acpi/battery/C1ED/info:present:                 yes
/proc/acpi/battery/C1ED/info:design capacity:         3614 mAh
/proc/acpi/battery/C1ED/info:last full capacity:      3614 mAh
/proc/acpi/battery/C1ED/info:battery technology:      rechargeable
/proc/acpi/battery/C1ED/info:design voltage:          11100 mV
/proc/acpi/battery/C1ED/info:design capacity warning: 181 mAh
/proc/acpi/battery/C1ED/info:design capacity low:     37 mAh
/proc/acpi/battery/C1ED/info:capacity granularity 1:  100 mAh
/proc/acpi/battery/C1ED/info:capacity granularity 2:  100 mAh
/proc/acpi/battery/C1ED/info:model number:            Primary
/proc/acpi/battery/C1ED/info:serial number:           01199 2007/06/29
/proc/acpi/battery/C1ED/info:battery type:            LIon
/proc/acpi/battery/C1ED/info:OEM info:                Hewlett-Packard

me@gnu:~$ ls -l /sys/class/power_supply/C1EB
insgesamt 0
lrwxrwxrwx 1 root root    0 13. Feb 20:28 device -> ../../../devices/LNXSYSTM:00/device:00/ACPI0003:00
-r--r--r-- 1 root root 4096 13. Feb 20:28 online
drwxr-xr-x 2 root root    0 13. Feb 20:47 power
lrwxrwxrwx 1 root root    0 13. Feb 20:28 subsystem -> ../../../class/power_supply
-r--r--r-- 1 root root 4096 13. Feb 20:28 type
-rw-r--r-- 1 root root 4096 13. Feb 20:28 uevent
me@gnu:~$ ls -l /sys/class/power_supply/C1ED
insgesamt 0
-rw-r--r-- 1 root root 4096 13. Feb 20:55 alarm
-r--r--r-- 1 root root 4096 13. Feb 20:28 charge_full
-r--r--r-- 1 root root 4096 13. Feb 20:28 charge_full_design
-r--r--r-- 1 root root 4096 13. Feb 20:28 charge_now
-r--r--r-- 1 root root 4096 13. Feb 20:28 current_now
lrwxrwxrwx 1 root root    0 13. Feb 20:28 device -> ../../../devices/LNXSYSTM:00/device:00/PNP0C0A:00
-r--r--r-- 1 root root 4096 13. Feb 20:28 manufacturer
-r--r--r-- 1 root root 4096 13. Feb 20:55 model_name
drwxr-xr-x 2 root root    0 13. Feb 20:55 power
-r--r--r-- 1 root root 4096 13. Feb 20:28 present
-r--r--r-- 1 root root 4096 13. Feb 20:28 status
lrwxrwxrwx 1 root root    0 13. Feb 20:28 subsystem -> ../../../class/power_supply
-r--r--r-- 1 root root 4096 13. Feb 20:28 technology
-r--r--r-- 1 root root 4096 13. Feb 20:28 type
-rw-r--r-- 1 root root 4096 13. Feb 20:28 uevent
-r--r--r-- 1 root root 4096 13. Feb 20:55 voltage_min_design
-r--r--r-- 1 root root 4096 13. Feb 20:28 voltage_now

me@gnu:~$ lspci
00:00.0 Host bridge: ATI Technologies Inc RS690 Host Bridge
00:01.0 PCI bridge: ATI Technologies Inc RS690 PCI to PCI Bridge (Internal gfx)
00:04.0 PCI bridge: ATI Technologies Inc Unknown device 7914
00:05.0 PCI bridge: ATI Technologies Inc Unknown device 7915
00:06.0 PCI bridge: ATI Technologies Inc RS690 PCI to PCI Bridge (PCI Express Port 2)
00:12.0 SATA controller: ATI Technologies Inc SB600 Non-Raid-5 SATA
00:13.0 USB Controller: ATI Technologies Inc SB600 USB (OHCI0)
00:13.1 USB Controller: ATI Technologies Inc SB600 USB (OHCI1)
00:13.2 USB Controller: ATI Technologies Inc SB600 USB (OHCI2)
00:13.3 USB Controller: ATI Technologies Inc SB600 USB (OHCI3)
00:13.4 USB Controller: ATI Technologies Inc SB600 USB (OHCI4)
00:13.5 USB Controller: ATI Technologies Inc SB600 USB Controller (EHCI)
00:14.0 SMBus: ATI Technologies Inc SBx00 SMBus Controller (rev 14)
00:14.1 IDE interface: ATI Technologies Inc SB600 IDE
00:14.2 Audio device: ATI Technologies Inc SBx00 Azalia
00:14.3 ISA bridge: ATI Technologies Inc SB600 PCI to LPC Bridge
00:14.4 PCI bridge: ATI Technologies Inc SBx00 PCI to PCI Bridge
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:05.0 VGA compatible controller: ATI Technologies Inc RS690M [Radeon X1200 Series]
02:04.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b6)
10:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express (rev 02)
30:00.0 Network controller: Broadcom Corporation BCM4312 802.11a/b/g (rev 02)

me@gnu:~$ dmesg|grep battery
ACPI: Battery Slot [C1ED] (battery present)
ACPI: Battery Slot [C1EC] (battery absent)


It should be clear, that kpowersave (or some backend which it uses) calculates this informations wrong, but I think the new way (if it's not a bug) to show each potential battery, unless it's connected or not (and I think I don't have an second battery slot ;)) is wrong.
It's confusing for me, too, that in /proc/acpi/battery are C1EC and C1ED reoported and in /sys/class/power_supply/ C1EB and C1ED. This seems wrong for me.

Unless I think the following git commit from 2.6.24 could cause this problem for me: 508df92d1f8d1921013cb4f45bb547d0eaff912a

Because it should prevent such situations which I never had got but now.
Comment 1 Patrick Matthäi 2008-02-13 12:03:41 UTC
Created attachment 14798 [details]
My Kernel config
Comment 2 Anonymous Emailer 2008-02-13 12:31:14 UTC
Reply-To: akpm@linux-foundation.org

On Wed, 13 Feb 2008 12:00:11 -0800 (PST)
bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=9957
>
>            Summary: Battery gives me now two batterys, but only one is
>                     present

yeah, I'm seeing this on the t61p as well, but have thus far ignored it
amongst the storm of other problems.


>            Product: ACPI
>            Version: 2.5
>      KernelVersion: 2.6.24.2
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Power-Battery
>         AssignedTo: acpi_power-battery@kernel-bugs.osdl.org
>         ReportedBy: patrick.matthaei@web.de
> 
> 
> Latest working kernel version: 2.6.23.14
> Earliest failing kernel version: 2.6.24

And it's a regression.
Comment 3 Anonymous Emailer 2008-02-14 06:05:41 UTC
Reply-To: mjg59@srcf.ucam.org

On Wed, Feb 13, 2008 at 12:31:12PM -0800, Andrew Morton wrote:

> And it's a regression.

No, it's a feature. You've configured in both the legacy and the sysfs 
interfaces for the battery, and hal is picking up both of them. There's 
a patch upstream to make hal realise that they're the same device, but 
the alternative is just to disable one of the options.
Comment 4 ykzhao 2008-02-14 17:24:14 UTC
Hi, Patrick
   Will you please attach the acpidump output? 
   Thanks.
Comment 5 Patrick Matthäi 2008-02-14 23:55:52 UTC
Created attachment 14849 [details]
ACPIDUMP
Comment 6 Patrick Matthäi 2008-02-14 23:56:24 UTC
Sure, and here it is :)
Comment 7 Rafael J. Wysocki 2008-02-17 14:20:15 UTC
On Thursday, 14 of February 2008, Matthew Garrett wrote:
> On Wed, Feb 13, 2008 at 12:31:12PM -0800, Andrew Morton wrote:
> 
> > And it's a regression.
> 
> No, it's a feature. You've configured in both the legacy and the sysfs 
> interfaces for the battery, and hal is picking up both of them. There's 
> a patch upstream to make hal realise that they're the same device, but 
> the alternative is just to disable one of the options.

Can you point me to the patch, please?

I'm running the current mainline and seeing this as well.

Thanks,
Rafael
Comment 8 Anonymous Emailer 2008-02-17 14:37:06 UTC
Reply-To: mjg59@srcf.ucam.org

On Sun, Feb 17, 2008 at 11:18:23PM +0100, Rafael J. Wysocki wrote:

> Can you point me to the patch, please?
> 
> I'm running the current mainline and seeing this as well.

http://cgit.freedesktop.org/hal/commit/?id=4541abd23fd02118a1a7f8b825aed338d2a5d638
Comment 9 Zhang Rui 2008-02-17 19:49:51 UTC
(In reply to comment #0)
> me@gnu:~$ dmesg|grep battery
> ACPI: Battery Slot [C1ED] (battery present)
> ACPI: Battery Slot [C1EC] (battery absent)
> It should be clear, that kpowersave (or some backend which it uses)
> calculates
> this informations wrong,
yes, and it should be fixed by the patch referred in comment #8.

> but I think the new way (if it's not a bug) to show
> each potential battery, unless it's connected or not (and I think I don't
> have
> an second battery slot ;)) is wrong.
No. In fact, it always works like this. ie. for your laptop, /proc always reports two batteries.

> It's confusing for me, too, that in /proc/acpi/battery are C1EC and C1ED
> reoported and in /sys/class/power_supply/ C1EB and C1ED. This seems wrong for
> me.
this is really weird, would you please make a double check?
Comment 10 Patrick Matthäi 2008-02-17 22:44:50 UTC
me@gnu:~$ ls /proc/acpi/battery/
C1EC  C1ED
me@gnu:~$ ls /sys/class/power_supply/
C1EB  C1ED
me@gnu:~$

Okay, two different names.
Comment 11 Zhang Rui 2008-02-18 21:49:30 UTC
hah, I see.
C1ED is the working battery and C1EB is the AC adapter.
C1EC is not registered as a power supply device because the battery does not present.
Comment 12 Zhang Rui 2008-02-18 21:53:45 UTC
hmm, so the real problem is fixed.
Close this bug and mark it as PATCH_ALREADY_AVAILABLE.
Patrick, please re-open it if you still have any problems.