Date: Wed, 23 Jun 2004 13:58:15 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: nate@root.org Cc: acpi@freebsd.org Subject: Re: apm problem Message-ID: <20040623.135815.22018529.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>
index | next in thread | previous in thread | raw e-mail
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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040623.135815.22018529.imp>
