From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 7 16:42:11 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 243EA16A4CE for ; Wed, 7 Jul 2004 16:42:11 +0000 (GMT) Received: from ns1.interbgc.com (mail.interbgc.com [217.9.224.3]) by mx1.FreeBSD.org (Postfix) with SMTP id 1CA2543D48 for ; Wed, 7 Jul 2004 16:42:10 +0000 (GMT) (envelope-from nike_d@cytexbg.com) Received: (qmail 67101 invoked from network); 7 Jul 2004 16:42:09 -0000 Received: from nike_d@cytexbg.com by keeper.interbgc.com by uid 1002 with qmail-scanner-1.14 (uvscan: v4.1.60/v4335. spamassassin: 2.63. Clear:SA:0(-4.9/8.0):. Processed in 0.867573 secs); 07 Jul 2004 16:42:09 -0000 X-Spam-Status: No, hits=-4.9 required=8.0 Received: from 213-240-206-214.1697748.ddns.cablebg.net (HELO tormentor.totalterror.net) (213.240.206.214) by mail.interbgc.com with SMTP; 7 Jul 2004 16:42:07 -0000 Received: (qmail 47545 invoked from network); 7 Jul 2004 16:39:25 -0000 Received: from unknown (HELO phobos.totalterror.net) (10.0.0.2) by tormentor.totalterror.net with SMTP; 7 Jul 2004 16:39:25 -0000 References: <20040704204353.26b4496b.liamfoy@sepulcrum.org> <20040704.140429.37607877.imp@bsdimp.com> Message-ID: X-Mailer: http://www.courier-mta.org/cone/ From: Niki Denev To: acpi@freebsd.org, hackers@FreeBSD.ORG Date: Wed, 07 Jul 2004 19:42:35 +0300 Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=_mimegpg-phobos.totalterror.net-586-1089218555-0002"; micalg=pgp-sha1; protocol="application/pgp-signature" 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: Wed, 07 Jul 2004 16:42:11 -0000 This is a MIME GnuPG-signed message. If you see this text, it means that your E-mail or Usenet software does not support MIME signed messages. --=_mimegpg-phobos.totalterror.net-586-1089218555-0002 Content-Type: text/plain; format=flowed; charset="US-ASCII" Content-Disposition: inline Content-Transfer-Encoding: 7bit Niki Denev writes: > M. Warner Losh writes: > >> 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 > > 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; > } > > > > -- > Regards, > Niki So, is this Ok or not? :) I'm running with this for a few days... no probs... But also the only time that this is used probably is in apm(8) ? It seems to not affect the math with ->min, by maybe it is not the cleanest solution to this cosmetic problem? :) -- Cheers, Niki --=_mimegpg-phobos.totalterror.net-586-1089218555-0002 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBA7Cf7HNAJ/fLbfrkRAsg5AKDHW+ce/8rWR51VSoIRg2egUmeh5wCcDJ7a IeY18nH/URxQv//rTmjHLG4= =ZAow -----END PGP SIGNATURE----- --=_mimegpg-phobos.totalterror.net-586-1089218555-0002--