Debian Bug report logs - #502511
acpi reports (incorrect) mAh-values instead of mWh

version graph

Package: acpi; Maintainer for acpi is Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>; Source for acpi is src:acpi (PTS, buildd, popcon).

Reported by: Kai Muenz <squ@tent.at>

Date: Fri, 17 Oct 2008 08:18:01 UTC

Severity: minor

Found in version acpi/1.2-1

Fixed in version acpi/1.3-1

Done: Michael Meskes <meskes@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>:
Bug#502511; Package acpi. (Fri, 17 Oct 2008 08:18:04 GMT) (full text, mbox, link).


Acknowledgement sent to Kai Muenz <squ@tent.at>:
New Bug report received and forwarded. Copy sent to Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>. (Fri, 17 Oct 2008 08:18:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Kai Muenz <squ@tent.at>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: acpi reports (incorrect) mAh-values instead of mWh
Date: Fri, 17 Oct 2008 10:14:37 +0200
Package: acpi
Version: 1.2-1
Severity: minor

On an IBM Thinkpad R50p where /proc/acpi/battery/BAT0/info reads
design capacity:         77760 mWh
last full capacity:      61170 mWh

acpi -i prints
     Battery 0: Charging, 25%, 01:31:20 until charged
     Battery 0: design capacity 77760 mAh, last full capacity 61170 mAh = 78%
which is the incorrect value (mAh instead of mWh).

In Version 1.1-2 acpi without parameter prints
     Battery 0: Discharging, 0%, 00:00:39 remaining, design capacity 77760 mAh
which is also incorrect.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.27-01173-g02541b2
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages acpi depends on:
ii  libc6                         2.7-14     GNU C Library: Shared libraries

acpi recommends no packages.

acpi suggests no packages.

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>:
Bug#502511; Package acpi. (Tue, 21 Oct 2008 10:57:05 GMT) (full text, mbox, link).


Acknowledgement sent to Michael Meskes <meskes@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>. (Tue, 21 Oct 2008 10:57:05 GMT) (full text, mbox, link).


Message #10 received at 502511@bugs.debian.org (full text, mbox, reply):

From: Michael Meskes <meskes@debian.org>
To: Kai Muenz <squ@tent.at>, 502511@bugs.debian.org
Subject: Re: [Pkg-acpi-devel] Bug#502511: acpi reports (incorrect) mAh-values
Date: Tue, 21 Oct 2008 12:47:16 +0200
On Fri, Oct 17, 2008 at 10:14:37AM +0200, Kai Muenz wrote:
> On an IBM Thinkpad R50p where /proc/acpi/battery/BAT0/info reads
> design capacity:         77760 mWh
> last full capacity:      61170 mWh

Does it really list mWh? Normally battery capacity is listed in mAh.

What does it list under /sys/class/power_supply?

> acpi -i prints
>      Battery 0: Charging, 25%, 01:31:20 until charged
>      Battery 0: design capacity 77760 mAh, last full capacity 61170 mAh = 78%

This information is taken from /sys/class/power_supply unless you also specify the "-p" parameter.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>:
Bug#502511; Package acpi. (Tue, 02 Dec 2008 19:42:09 GMT) (full text, mbox, link).


Acknowledgement sent to Paul Martin <pm@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>. (Tue, 02 Dec 2008 19:42:10 GMT) (full text, mbox, link).


Message #15 received at 502511@bugs.debian.org (full text, mbox, reply):

From: Paul Martin <pm@debian.org>
To: Debian Bug Tracking System <502511@bugs.debian.org>
Subject: acpi: Definitely mWh.
Date: Tue, 02 Dec 2008 19:16:18 +0000
Package: acpi
Version: 1.2-1
Followup-For: Bug #502511

# cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charging
present rate:            15682 mW
remaining capacity:      30560 mWh
present voltage:         12378 mV
# cat /proc/acpi/battery/BAT0/info
present:                 yes
design capacity:         47510 mWh
last full capacity:      36160 mWh
battery technology:      rechargeable
design voltage:          10800 mV
design capacity warning: 1808 mWh
design capacity low:     200 mWh
capacity granularity 1:  1 mWh
capacity granularity 2:  1 mWh
model number:            IBM-92P1060
serial number:            1371
battery type:            LION
OEM info:                Panasonic


root@thinkpad:/sys/class/power_supply/BAT0# cat status
Charging
root@thinkpad:/sys/class/power_supply/BAT0# cat energy_now
30670000
root@thinkpad:/sys/class/power_supply/BAT0# cat energy_full
36160000
root@thinkpad:/sys/class/power_supply/BAT0# cat energy_full_design
47510000
root@thinkpad:/sys/class/power_supply/BAT0# cat current_now
1192000
root@thinkpad:/sys/class/power_supply/BAT0# cat voltage_now
12411000


So, energy_* are in µWh and current_now is in µA.

The battery is a nominal capacity of 4400mAh at 10.8V. That's 47.5Wh, 
which corresponds with the "energy_full_design" value.

acpi.c incorrectly considers charge_* and energy_* values to be 
equivalent. charge_* values (if present) will be in µAh, and energy_* 
values (if present) are in µWh.

To convert energy_* values into the equivalent charge_* values, you need 
to divide by (voltage_now/1000000), avoiding overflows or underflows in 
the integer arithmetic.

eg. charge_value = (energy_value / (voltage_now/1000) ) *1000;


Note that 2.6.28-rc7 has the following patch, which triggers this:

commit 558073dd56707864f09d563b64e7c37c021e89d2
Author: Alexey Starikovskiy <aystarik@gmail.com>
Date:   Fri Nov 21 22:41:01 2008 +0800

    ACPI: battery: Convert discharge energy rate to current properly

    ACPI battery interface reports its state either in mW or in mA, and
    discharge rate in your case is reported in mW. power_supply interface
    does not have such a parameter, so current_now parameter is used
    for all cases. But in case of mW, reported discharge should
    be converted into mA.

    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
    Tested-by: Ferenc Wagner <wferi@niif.hu>
    Signed-off-by: Len Brown <len.brown@intel.com>


hal has a similar bug. powertop does not.

In addition, "acpi -p" fails because the string "present_rate" should be 
"present rate":

                        } else if (!strcasecmp(value->attr, "present_rate")) {
                                present_rate = get_unit_value(value->value);


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (99, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.28-rc7
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages acpi depends on:
ii  libc6                         2.7-16     GNU C Library: Shared libraries

acpi recommends no packages.

acpi suggests no packages.

-- no debconf information




Reply sent to Michael Meskes <meskes@debian.org>:
You have taken responsibility. (Wed, 11 Feb 2009 10:45:04 GMT) (full text, mbox, link).


Notification sent to Kai Muenz <squ@tent.at>:
Bug acknowledged by developer. (Wed, 11 Feb 2009 10:45:04 GMT) (full text, mbox, link).


Message #20 received at 502511-close@bugs.debian.org (full text, mbox, reply):

From: Michael Meskes <meskes@debian.org>
To: 502511-close@bugs.debian.org
Subject: Bug#502511: fixed in acpi 1.3-1
Date: Wed, 11 Feb 2009 10:17:03 +0000
Source: acpi
Source-Version: 1.3-1

We believe that the bug you reported is fixed in the latest version of
acpi, which is due to be installed in the Debian FTP archive:

acpi_1.3-1.diff.gz
  to pool/main/a/acpi/acpi_1.3-1.diff.gz
acpi_1.3-1.dsc
  to pool/main/a/acpi/acpi_1.3-1.dsc
acpi_1.3-1_amd64.deb
  to pool/main/a/acpi/acpi_1.3-1_amd64.deb
acpi_1.3.orig.tar.gz
  to pool/main/a/acpi/acpi_1.3.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 502511@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Meskes <meskes@debian.org> (supplier of updated acpi package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 11 Feb 2009 10:49:45 +0100
Source: acpi
Binary: acpi
Architecture: source amd64
Version: 1.3-1
Distribution: unstable
Urgency: low
Maintainer: Debian Acpi Team <pkg-acpi-devel@lists.alioth.debian.org>
Changed-By: Michael Meskes <meskes@debian.org>
Description: 
 acpi       - displays information on ACPI devices
Closes: 502511
Changes: 
 acpi (1.3-1) unstable; urgency=low
 .
   * New upstream version, closes: #502511
Checksums-Sha1: 
 538837d3da38d2935c5b779c0a962170d91a256f 1005 acpi_1.3-1.dsc
 260ed83388aae62d1193b741dc2ba55ceccf8df5 85294 acpi_1.3.orig.tar.gz
 2142551597f531591c7622659db4e512319fb420 3399 acpi_1.3-1.diff.gz
 37df2a9d871ca236c1f8902a8e3aecf2caff5962 15572 acpi_1.3-1_amd64.deb
Checksums-Sha256: 
 5b1fe26add88fb0c49853df2428133b7f72e15790a4b3b7259db668c4ab007d1 1005 acpi_1.3-1.dsc
 136556945d3dfde28c991282d1e75d08fa6f91ecd849b5fe68bd94893e90f991 85294 acpi_1.3.orig.tar.gz
 7aca08d9af0b3b0e0d01ca6f661de5ff6eb138d5d86b27a3bfd43d680fb5144b 3399 acpi_1.3-1.diff.gz
 734ec0df5c9f9d27a4ebe344067c38d9ba7a7d0c639fce25d9c734816f9a5242 15572 acpi_1.3-1_amd64.deb
Files: 
 ca3769b0f13d3f7aa8ac66f083283680 1005 utils optional acpi_1.3-1.dsc
 5851e5515e9d3b08160f64be0f8c1827 85294 utils optional acpi_1.3.orig.tar.gz
 676ec92f31e7ab96321b41b78091b763 3399 utils optional acpi_1.3-1.diff.gz
 e7ddf69408eebc13eaed755f2d6a3157 15572 utils optional acpi_1.3-1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJkqB3VkEm8inxm9ERAuoiAJ9tH2G9W2iEN3P4YhBNbHIbkILRlgCfST0b
aqlnkgGZ4xXrEq47pxnFXPo=
=RLoX
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 13 Mar 2009 07:28:29 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Jan 4 20:38:58 2018; Machine Name: beach

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.