NetBSD Problem Report #26438

Received: (qmail 19753 invoked by uid 605); 26 Jul 2004 21:49:01 -0000
Message-Id: <20040726214858.26F3233C5F@kafka.verkstad.net>
Date: Mon, 26 Jul 2004 23:48:58 +0200 (CEST)
From: mer@klockrike.net
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: mer@klockrike.net
To: gnats-bugs@gnats.NetBSD.org
Cc: mer@klockrike.net
Subject: asapm doesn't handle Ampere-based sysmon battery info
X-Send-Pr-Version: 3.95

>Number:         26438
>Category:       pkg
>Synopsis:       asapm doesn't handle Ampere-based sysmon battery info
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 26 21:50:00 +0000 2004
>Closed-Date:    Mon Jul 26 23:26:21 +0000 2004
>Last-Modified:  Mon Jul 26 23:26:21 +0000 2004
>Originator:     Michael Eriksson
>Release:        NetBSD 2.0_BETA
>Organization:
>Environment:
Architecture: i386
Machine: i386
>Description:

The patches for asapm to try sysmon if APM fails, only support battery
info in units of Watts and Watt hours. However, some machines like my
Compaq Presario X1007EA laptop uses units of Amperes and Ampere hours.


>How-To-Repeat:

Try to use asapm on a machine that gives battery info in units of
Amperes and Ampere hours.

>Fix:

Index: patches/patch-af
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/asapm/patches/patch-af,v
retrieving revision 1.4
diff -u -r1.4 patch-af
--- patches/patch-af	30 Jun 2004 14:22:49 -0000	1.4
+++ patches/patch-af	26 Jul 2004 21:29:17 -0000
@@ -10,7 +10,7 @@

  #include "state.h"
  extern struct apm_state state;
-@@ -136,18 +137,183 @@ void ReadAPMDevice( )		/* FreeBSD versio
+@@ -136,18 +137,185 @@
  	state.time_left = info.ai_batt_time / 60;
  }
  #elif defined(__NetBSD__)||defined(__OpenBSD__)
@@ -84,8 +84,9 @@
 +			continue;
 +
 +#ifdef HAVE_ENVSYS_SWATTHOUR
-+		if (etds.units == ENVSYS_SWATTHOUR) {
-+			/* Watt hours, this must be battery capacity info. */
++		if (etds.units == ENVSYS_SWATTHOUR ||
++		    etds.units == ENVSYS_SAMPHOUR) {
++			/* Watt or amp hours, this must be battery cap info. */
 +			if (match_end(ebis.desc, " design cap")) {
 +				design += etds.cur.data_s;
 +			} else if (match_end(ebis.desc, " charge")) {
@@ -108,8 +109,9 @@
 +
 +		}
 +#endif /* HAVE_ENVSYS_INDICATOR */
-+		if (etds.units == ENVSYS_SWATTS) {
-+			/* Watts, this must discharge rate. */
++		if (etds.units == ENVSYS_SWATTS ||
++		    etds.units == ENVSYS_SAMPS) {
++			/* Watts or apms, this must discharge rate. */
 +			if (match_end(ebis.desc, " discharge rate")) {
 +				discharge_rate += etds.cur.data_s;
 +			} else if (match_end(ebis.desc, " charge rate")) {

>Release-Note:
>Audit-Trail:

From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/26438 CVS commit: pkgsrc/sysutils/asapm
Date: Mon, 26 Jul 2004 23:25:19 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Mon Jul 26 23:25:19 UTC 2004

 Modified Files:
 	pkgsrc/sysutils/asapm: Makefile distinfo
 	pkgsrc/sysutils/asapm/patches: patch-af

 Log Message:
 Add patch from Michael Eriksson in PR 26438:
 The patches for asapm to try sysmon if APM fails, only support battery
 info in units of Watts and Watt hours. However, some machines like my
 Compaq Presario X1007EA laptop uses units of Amperes and Ampere hours.

 Bump PKGREVISION.


 To generate a diff of this commit:
 cvs rdiff -r1.28 -r1.29 pkgsrc/sysutils/asapm/Makefile
 cvs rdiff -r1.8 -r1.9 pkgsrc/sysutils/asapm/distinfo
 cvs rdiff -r1.4 -r1.5 pkgsrc/sysutils/asapm/patches/patch-af

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed 
State-Changed-By: wiz 
State-Changed-When: Mon Jul 26 23:26:13 UTC 2004 
State-Changed-Why:  
Added to the package, thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.