From nobody@FreeBSD.org  Wed Sep 29 18:31:55 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 55E5616A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Sep 2004 18:31:55 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2FAB143D49
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Sep 2004 18:31:55 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i8TIVs66010850
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Sep 2004 18:31:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i8TIVsIu010849;
	Wed, 29 Sep 2004 18:31:54 GMT
	(envelope-from nobody)
Message-Id: <200409291831.i8TIVsIu010849@www.freebsd.org>
Date: Wed, 29 Sep 2004 18:31:54 GMT
From: Niki Denev <nike_d@cytexbg.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Inconsistent apm(8) output regarding the remaining battery time, when running acpi enabled laptop on AC power
X-Send-Pr-Version: www-2.3

>Number:         72179
>Category:       i386
>Synopsis:       [acpi] [patch] Inconsistent apm(8) output regarding the remaining battery time, when running acpi enabled laptop on AC power
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gavin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 29 18:40:14 GMT 2004
>Closed-Date:    Wed Feb 20 17:14:16 UTC 2008
>Last-Modified:  Wed Feb 20 17:14:16 UTC 2008
>Originator:     Niki Denev
>Release:        6.0-CURRENT
>Organization:
>Environment:
FreeBSD phobos.totalterror.net 6.0-CURRENT FreeBSD 6.0-CURRENT #5: Sun Sep 26 12:25:15 EEST 2004     root@phobos.totalterror.net:/usr/src/sys/i386/compile/PHOBOS-X31 i386
>Description:
the apm(8) utility will display the total remainig life and time for the batteries, and then will display the remaining time and life for each individual battery on a laptop.
When the laptop is connected to AC adaptor,
running apm will show the total remaining time as 'unknown', but for the batteries it will print '0:00:00'.
>How-To-Repeat:
Laptop running on batteries:

[root@phobos ]# apm
APM version: 1.2
APM Management: Disabled
AC Line status: off-line
Battery Status: low
Remaining battery life: 27%
Remaining battery time: 1:16:00
Number of batteries: 1
Battery 0:
        Battery Status: low
        Remaining battery life: 27%
        Remaining battery time: 1:16:00
Resume timer: unknown
Resume on ring indicator: disabled

Laptop running on AC:

[root@phobos ]# apm
APM version: 1.2
APM Management: Disabled
AC Line status: on-line
Battery Status: charging
Remaining battery life: 27%
Remaining battery time: unknown
                        ^^^^^^^
Number of batteries: 1
Battery 0:
        Battery Status: charging
        Remaining battery life: 27%
        Remaining battery time: 0:00:00
                                ^^^^^^^
Resume timer: unknown
Resume on ring indicator: disabled

>Fix:
The following patch fixes the problem :
----------------------------------------------------------------------
--- sys/dev/acpica/acpi_cmbat.c.orig	Mon Jul  5 15:15:28 2004
+++ sys/dev/acpica/acpi_cmbat.c	Mon Jul  5 16:37:02 2004
@@ -655,7 +655,7 @@
 	battinfo->state = ACPI_BATT_STAT_NOT_PRESENT;
     } else {
 	battinfo->cap = sc->cap;
-	battinfo->min = sc->min;
+	battinfo->min = sc->min ? sc->min : -1;
 	battinfo->state = sc->bst.state;
     }
----------------------------------------------------------------------

Patch can be found at: http://www.totalterror.net/src/acpi_cmbat.c.patch

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-acpi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Apr 28 09:15:24 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72179 

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, nike_d@cytexbg.com
Cc:  
Subject: Re: i386/72179: [acpi] [patch] Inconsistent apm(8) output regarding
 the remaining battery time, when running acpi enabled laptop on AC power
Date: Wed, 20 Feb 2008 00:31:21 +0100

 There have been changes made to acpica (in 2006). Now apm gives on 7.0:
 
 %apm
 APM version: 1.2
 APM Management: Disabled
 AC Line status: on-line
 Battery Status: high
 Remaining battery life: 98%
 Remaining battery time: unknown
 Number of batteries: 2
 Battery 0:
 	Battery Status: high
 	Remaining battery life: 97%
 	Remaining battery time: unknown
 Battery 1:
 	Battery Status: high
 	Remaining battery life: 100%
 	Remaining battery time: unknown
 Resume timer: unknown
 Resume on ring indicator: disabled
 
 The patch and this PR is now obsolete for at least 6.3 and 7.0.
State-Changed-From-To: open->feedback 
State-Changed-By: gavin 
State-Changed-When: Wed Feb 20 15:19:48 UTC 2008 
State-Changed-Why:  
To submitter:  It looks like this has been fixed in at least FreeBSD 6.3 
and 7.0.  Can you please retest and confirm that this is the case? 


Responsible-Changed-From-To: freebsd-acpi->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Wed Feb 20 15:19:48 UTC 2008 
Responsible-Changed-Why:  
Track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72179 
State-Changed-From-To: feedback->closed 
State-Changed-By: gavin 
State-Changed-When: Wed Feb 20 17:12:47 UTC 2008 
State-Changed-Why:  
Submitter reports in http://docs.FreeBSD.org/cgi/mid.cgi?2e77fc10802200744g8e940ccmd1e3a4837f2b83d7 
that this was fixed a long time ago 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72179 
>Unformatted:
