From owner-freebsd-acpi@FreeBSD.ORG Wed Jun 23 22:47:33 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACA8B16A4CE for ; Wed, 23 Jun 2004 22:47:33 +0000 (GMT) Received: from root.org (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 0790143D3F for ; Wed, 23 Jun 2004 22:47:33 +0000 (GMT) (envelope-from nate@root.org) Received: (qmail 87952 invoked by uid 1000); 23 Jun 2004 22:47:17 -0000 Date: Wed, 23 Jun 2004 15:47:17 -0700 (PDT) From: Nate Lawson To: "M. Warner Losh" In-Reply-To: <20040623.151107.13281033.imp@bsdimp.com> Message-ID: <20040623141913.Q87505@root.org> References: <20040623123827.O86825@root.org> <20000623205805.4c299e4e.liamfoy@sepulcrum.org> <20040623.151107.13281033.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: acpi@FreeBSD.ORG Subject: Re: apm problem X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2004 22:47:33 -0000 On Wed, 23 Jun 2004, M. Warner Losh wrote: > In message: <20040623135554.V87272@root.org> > Nate Lawson writes: > : On Fri, 23 Jun 2000, Liam J. Foy wrote: > : > On Wed, 23 Jun 2004 12:40:40 -0700 (PDT) > : > We decided to go with -1. The apm.c patch currently will not apply due to > : > the re-structure of apm. The following patch will: > : > > : > http://liamfoy.kerneled.org/apm.diff > : > : Ok, good. That should help Warner. > : > : > After more digging, apm -l should return 255(stated in man page and acpi spec). > : > The following patch will make it work: > : > > : > --- /usr/src/sys/dev/acpica/acpi_cmbat.c Tue Jun 22 16:40:35 2004 > : > +++ /hd2/acpi_cmbat.c Tue Jun 22 17:02:18 2004 > : > @@ -449,7 +449,7 @@ > : > static int bat_units = 0; > : > static struct acpi_cmbat_softc **bat = NULL; > : > > : > - cap = min = -1; > : > + cap = min = 255; > : > batt_stat = ACPI_BATT_STAT_NOT_PRESENT; > : > error = 0; > : > > : > @@ -545,7 +545,7 @@ > : > > : > /* Battery life */ > : > if (valid_units == 0) { > : > - cap = -1; > : > + cap = 255; > : > batt_stat = ACPI_BATT_STAT_NOT_PRESENT; > : > } else { > : > cap = total_cap / valid_units; > : > @@ -649,7 +649,7 @@ > : > } > : > > : > if (!sc->present) { > : > - battinfo->cap = -1; > : > + battinfo->cap = 255; > : > battinfo->min = -1; > : > battinfo->state = ACPI_BATT_STAT_NOT_PRESENT; > : > } else { > : > : I disagree with this. Capacity and time remaining are both quantities > : represented by ints that we calculate. The man page should be updated if > : it's incorrect. > > That's why I've been reluctant to make these changes... Let's just update the man page. The use of -1 is the actual behavior and programs have been written that count on this. -Nate