From owner-freebsd-acpi@FreeBSD.ORG  Wed Jun 23 20:01:03 2004
Return-Path: <owner-freebsd-acpi@FreeBSD.ORG>
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 44F3316A5D9
	for <acpi@freebsd.org>; Wed, 23 Jun 2004 20:01:03 +0000 (GMT)
Received: from harmony.village.org (rover.village.org [168.103.84.182])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B012643D60
	for <acpi@freebsd.org>; Wed, 23 Jun 2004 20:00:45 +0000 (GMT)
	(envelope-from imp@bsdimp.com)
Received: from localhost (warner@rover2.village.org [10.0.0.1])
	by harmony.village.org (8.12.11/8.12.11) with ESMTP id i5NJw5gs092102;
	Wed, 23 Jun 2004 13:58:06 -0600 (MDT)
	(envelope-from imp@bsdimp.com)
Date: Wed, 23 Jun 2004 13:58:15 -0600 (MDT)
Message-Id: <20040623.135815.22018529.imp@bsdimp.com>
To: nate@root.org
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20040623123827.O86825@root.org>
References: <20040616171408.0f88c928.liamfoy@sepulcrum.org>
	<20040616.135044.85075412.imp@bsdimp.com>
	<20040623123827.O86825@root.org>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
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 <freebsd-acpi.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-acpi>,
	<mailto:freebsd-acpi-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-acpi>
List-Post: <mailto:freebsd-acpi@freebsd.org>
List-Help: <mailto:freebsd-acpi-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-acpi>,
	<mailto:freebsd-acpi-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jun 2004 20:01:03 -0000

In message: <20040623123827.O86825@root.org>
            Nate Lawson <nate@root.org> writes:
: On Wed, 16 Jun 2004, M. Warner Losh wrote:
: > As it relates to acpi, however, there is one bug.  First in
: > acpi_capm_get_info(), if we can't get the battery info, we do:
: >
: > 	if (acpi_battery_get_battinfo(-1, &batt)) {
: > 		aip->ai_batt_stat = 0xff;	/* unknown */
: > 		aip->ai_batt_life = 0xff;	/* unknown */
: > 		aip->ai_batt_time = -1;		/* unknown */
: > -		aip->ai_batteries = 0;
: > 	} else {
: >
: > instead, this should be:
: > 	if (acpi_battery_get_battinfo(-1, &batt)) {
: > 		aip->ai_batt_stat = 0xff;	/* unknown */
: > 		aip->ai_batt_life = 0xff;	/* unknown */
: > 		aip->ai_batt_time = -1;		/* unknown */
: > +		aip->ai_batteries = -1;		/* Unknown */ [*]
: > 	} else {
: >
: > [*] or 0xffffffff instead of -1.  0 is clearly wrong, since it means
: > no batteries, not the number of batteries cannot be determined.
: 
: I agree with this.  I'd like to use ~0 instead of (u_int)-1.  Up to you
: though.  Please commit.

OK.  I like it better than 0xffffffff.  Pedantically, it should likely
be ~(u_int)0 or something gross like that.

: Please commit this patch after deciding whether you want to go with ~0 or
: (u_int)-1.

I'll try to make this a #define...

Warner