apm problem

M. Warner Losh imp at bsdimp.com
Wed Jun 23 20:01:03 GMT 2004


In message: <20040623123827.O86825 at root.org>
            Nate Lawson <nate at 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


More information about the freebsd-acpi mailing list