From owner-freebsd-acpi@FreeBSD.ORG Thu May 20 15:04:37 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C894816A4CE for ; Thu, 20 May 2004 15:04:37 -0700 (PDT) Received: from hermes.py.intel.com (hermes.py.intel.com [146.152.216.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7195143D45 for ; Thu, 20 May 2004 15:04:37 -0700 (PDT) (envelope-from andrew.grover@intel.com) Received: from petasus.py.intel.com (petasus.py.intel.com [146.152.221.4]) 1.9 2004/01/09 00:55:23 root Exp $) with ESMTP id i4KM4a6G012314; Thu, 20 May 2004 22:04:36 GMT Received: from orsmsxvs040.jf.intel.com (orsmsxvs040.jf.intel.com [192.168.65.206]) large-inner.mc,v 1.10 2004/03/01 19:22:27 root Exp $) with SMTP id i4KM54Hv010687; Thu, 20 May 2004 22:05:04 GMT Received: from orsmsx331.amr.corp.intel.com ([192.168.65.56]) M2004052015042908255 ; Thu, 20 May 2004 15:04:29 -0700 Received: from orsmsx401.amr.corp.intel.com ([192.168.65.207]) by orsmsx331.amr.corp.intel.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 20 May 2004 15:04:09 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 20 May 2004 15:03:56 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: apm code Thread-Index: AcQ+pNQO9Ib9mqPHRRC6juRHQWUSZwADobpg From: "Grover, Andrew" To: "Liam J. Foy" , X-OriginalArrivalTime: 20 May 2004 22:04:09.0150 (UTC) FILETIME=[602935E0:01C43EB6] X-Scanned-By: MIMEDefang 2.31 (www . roaringpenguin . com / mimedefang) Subject: RE: apm code X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2004 22:04:37 -0000 > Just writing to the list to make sure am correct here. The=20 > issue concerns /usr/src/usr.sbin/apm/apm.c.=20 >=20 > --- /usr/src/usr.sbin/apm/apm.c Thu May 20 20:30:57 2004 > +++ /hd2/apm.c Thu May 20 20:44:36 2004 > @@ -174,7 +174,7 @@ > printf("Remaining battery life: "); > if (aip->ai_batt_life =3D=3D 255) > printf("unknown\n"); > - else if (aip->ai_batt_life <=3D 100) > + else if (aip->ai_batt_life >=3D 0 && aip->ai_batt_life <=3D 100) > printf("%d%%\n", aip->ai_batt_life); > else > printf("invalid value (0x%x)\n", aip->ai_batt_life); >=20 > The above patch will make apm print invalid value when=20 > ai_batt_life does not equal 0-100. The reason for this was=20 > the the current code was printing -1 as a so called valid=20 > value(normally when acline is connected). I dont think=20 > printing -1 is correct, and really it should be printing=20 > invalid value since that is what it is. Do you guys agree=20 > with me or does -1 symbolise something? if (aip->ai_batt_life =3D=3D 255) printf("unknown\n"); The above line should catch the -1 case. There's a uint/uchar sign extension problem. Changing the 255 to -1 will probably fix things. Regards -- Andy