apm problem

Liam J. Foy liamfoy at sepulcrum.org
Wed Jun 16 23:16:06 GMT 2004


On Wed, 16 Jun 2004 16:41:42 -0600 (MDT)
"M. Warner Losh" <imp at bsdimp.com> wrote:

> In message: <20040616233345.01cdd6de.liamfoy at sepulcrum.org>
>             "Liam J. Foy" <liamfoy at sepulcrum.org> writes:
> : On Wed, 16 Jun 2004 16:25:42 -0600 (MDT)
> : "M. Warner Losh" <imp at bsdimp.com> wrote:
> : 
> : > In message: <20040616231428.2b531dba.liamfoy at sepulcrum.org>
> : >             "Liam J. Foy" <liamfoy at sepulcrum.org> writes:
> : > : You mentioned you had the driver patches, can you send these to me
> : > : in order for me to test them. Also to present them fully and see what
> : > : Nate and whoever think.
> : > 
> : > Here's what I have.
> : > 
> : > Warner
> : > 
> : > Index: acpi_machdep.c
> : > ===================================================================
> : > RCS file: /home/ncvs/src/sys/i386/acpica/acpi_machdep.c,v
> : > retrieving revision 1.21
> : > diff -u -r1.21 acpi_machdep.c
> : > --- acpi_machdep.c	10 Jun 2004 20:43:01 -0000	1.21
> : > +++ acpi_machdep.c	16 Jun 2004 22:25:13 -0000
> : > @@ -80,7 +80,7 @@
> : >  {
> : >  	int	state;
> : >  
> : > -	state = 0xff;	/* XXX unknown */
> : > +	state = APM_UNKNOWN;		/* unknown */
> : >  
> : >  	if (battp->state & ACPI_BATT_STAT_DISCHARG) {
> : >  		if (battp->cap >= 50)
> : > @@ -94,7 +94,7 @@
> : >  		state = 3;		/* charging */
> : >  
> : >  	/* If still unknown, determine it based on the battery capacity. */
> : > -	if (state == 0xff) {
> : > +	if (state == APM_UNKNOWN) {
> : >  		if (battp->cap >= 50)
> : >  			state = 0;	/* high */
> : >  		else
> : > @@ -137,18 +137,18 @@
> : >  	aip->ai_major       = 1;
> : >  	aip->ai_minor       = 2;
> : >  	aip->ai_status      = apm_softc.active;
> : > -	aip->ai_capabilities= 0xff00;	/* XXX unknown */
> : > +	aip->ai_capabilities= 0xff00;	/* unknown */
> : >  
> : >  	if (acpi_acad_get_acline(&acline))
> : > -		aip->ai_acline = 0xff;		/* unknown */
> : > +		aip->ai_acline = APM_UNKNOWN;	/* unknown */
> : >  	else
> : >  		aip->ai_acline = acline;	/* on/off */
> : >  
> : >  	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;
> : > +		aip->ai_batt_stat = APM_UNKNOWN; /* unknown */
> : > +		aip->ai_batt_life = APM_UNKNOWN; /* unknown */
> : > +		aip->ai_batt_time = -1;		 /* unknown */
> : > +		aip->ai_batteries = 0xffffffff;	 /* unknown */
> : >  	} else {
> : >  		aip->ai_batt_stat = acpi_capm_convert_battstate(&batt);
> : >  		aip->ai_batt_life = batt.cap;
> : > @@ -184,7 +184,7 @@
> : >  	app->ap_batt_time = (batt.min == -1) ? -1 : batt.min * 60;
> : >  
> : >  	if (acpi_acad_get_acline(&acline))
> : > -		app->ap_acline = 0xff;		/* unknown */
> : > +		app->ap_acline = APM_UNKNOWN;	/* unknown */
> : >  	else
> : >  		app->ap_acline = acline;	/* on/off */
> : >  
> : 
> : Thats great. I will change the apm code. I will then present
> : this altogether. You think thats the best course of action?
> 
> I've committed a change to the apm driver that sould make this right.
> 
> Warner

Great. You may also want to look at:

http://liamfoy.kerneled.org/apm.diff


-Liam


More information about the freebsd-acpi mailing list