From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 4 20:05:23 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9957F16A4CE; Sun, 4 Jul 2004 20:05:23 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4142243D1F; Sun, 4 Jul 2004 20:05:23 +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 i64K4RjG033949; Sun, 4 Jul 2004 14:04:27 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 04 Jul 2004 14:04:29 -0600 (MDT) Message-Id: <20040704.140429.37607877.imp@bsdimp.com> To: liamfoy@sepulcrum.org From: "M. Warner Losh" In-Reply-To: <20040704204353.26b4496b.liamfoy@sepulcrum.org> References: <20040704204353.26b4496b.liamfoy@sepulcrum.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 cc: hackers@FreeBSD.ORG Subject: Re: APM Patches X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jul 2004 20:05:23 -0000 In message: <20040704204353.26b4496b.liamfoy@sepulcrum.org> "Liam J. Foy" 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