Date: Mon, 5 Jul 2004 16:46:32 +0100 From: "Liam J. Foy" <liamfoy@sepulcrum.org> To: Niki Denev <nike_d@cytexbg.com> Cc: hackers@FreeBSD.ORG Subject: Re: APM Patches Message-ID: <20040705164632.2228e12a.liamfoy@sepulcrum.org> In-Reply-To: <cone.1089035111.449699.675.1001@phobos.totalterror.net> References: <20040704204353.26b4496b.liamfoy@sepulcrum.org> <20040704.140429.37607877.imp@bsdimp.com> <cone.1089035111.449699.675.1001@phobos.totalterror.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 05 Jul 2004 16:45:11 +0300 Niki Denev <nike_d@cytexbg.com> wrote: > M. Warner Losh writes: > > > In message: <20040704204353.26b4496b.liamfoy@sepulcrum.org> > > "Liam J. Foy" <liamfoy@sepulcrum.org> writes: > > : Hey guys, > > : > > : Since it was decided (http://lists.freebsd.org/pipermail/freebsd-acpi/2004-June/000352.html) > > : we are going to stick with apm -l producing -1 and not 255 which is stated in the handbook would one > > : of you guys please commit: > > : > > : --- /usr/src/usr.sbin/apm/apm.8 Thu Jun 24 17:32:55 2004 > > : +++ /liamfoy/apm.8 Thu Jun 24 17:32:27 2004 > > : @@ -106,7 +106,7 @@ > > : state respectively. > > : .It Fl t > > : Display the estimated remaining battery lifetime in seconds. If > > : -it is unknown, 255 is displayed. > > : +it is unknown, -1 is displayed. > > : .It Fl Z > > : Transition the system into standby mode. This mode uses less power than > > : full power mode, but more than suspend mode. Some laptops support > > : > > : ---- > > : > > : Another patch I would like you guys to review is this. Currently apm -t will output > > : 0 when it cannot find a valid rate or the full battery time(as the comment mentions). > > : I think it should return -1 (unknown) to reflect an error, which is stated in the man page. > > : It should not return 0 since we do not have 0 seconds left, we have an unknown value > > : remaining. Either that or the man page it edited. I believe the following patch should > > : be commited really. > > : > > : The patch is: > > : > > : --- /usr/src/sys/dev/acpica/acpi_cmbat.c Sun Jul 4 20:41:43 2004 > > : +++ /home/liamfoy/acpi_cmbat.c Sun Jul 4 20:39:14 2004 > > : @@ -536,7 +536,7 @@ > > : bat[i]->min = (bat[i]->full_charge_time * bat[i]->cap) / 100; > > : } else { > > : /* Couldn't find valid rate and full battery time */ > > : - bat[i]->min = 0; > > : + bat[i]->min = -1; > > : } > > : total_min += bat[i]->min; > > : total_cap += bat[i]->cap; > > > > I don't like this patch, since we use ->min later for math... > > > > Warner > > What about this ? > > --- sys/dev/acpica/acpi_cmbat.c.orig Mon Jul 5 15:15:28 2004 > +++ sys/dev/acpica/acpi_cmbat.c Mon Jul 5 16:37:02 2004 > @@ -655,7 +655,7 @@ > battinfo->state = ACPI_BATT_STAT_NOT_PRESENT; > } else { > battinfo->cap = sc->cap; > - battinfo->min = sc->min; > + battinfo->min = sc->min ? sc->min : -1; > battinfo->state = sc->bst.state; > } > Hmm, yes. Actually looking now, this patch seem alot better. It should not affect the math. I like it. Up to the others. > > > -- > Regards, > Niki > -- -Liam J. Foy http://liamfoy.kerneled.org "Love is like maths -- the idea is simple but can be quite complicated."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040705164632.2228e12a.liamfoy>