From owner-freebsd-bugs Thu Sep 5 2:30:20 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D1AB37B405 for ; Thu, 5 Sep 2002 02:30:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A653D43E6A for ; Thu, 5 Sep 2002 02:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g859U2JU070400 for ; Thu, 5 Sep 2002 02:30:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g859U2sq070399; Thu, 5 Sep 2002 02:30:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F4DC37B400 for ; Thu, 5 Sep 2002 02:29:55 -0700 (PDT) Received: from bigboy.spc.org (dolly.good1.com [195.206.69.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3EE1843E6A for ; Thu, 5 Sep 2002 02:29:54 -0700 (PDT) (envelope-from bms@spc.org) Message-Id: <20020905092839.6EA559696@triage.dollah.com> Date: Thu, 5 Sep 2002 10:28:39 +0100 (BST) From: Bruce M Simpson Reply-To: Bruce M Simpson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: i386/42439: i386/apm: battery time reported incorrectly on Sony Vaio Z600 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 42439 >Category: i386 >Synopsis: i386/apm: battery time reported incorrectly on Sony Vaio Z600 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 05 02:30:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bruce M Simpson >Release: FreeBSD 4.6-STABLE i386 >Organization: >Environment: System: FreeBSD triage.dollah.com 4.6-STABLE FreeBSD 4.6-STABLE #2: Wed Sep 4 18:52:52 BST 2002 root@triage.dollah.com:/usr/src/sys/compile/TRIAGE i386 >Description: Certain models of laptop have an APM bios bug which reports the battery time with the incorrect byte order. The Sony Vaio PCG-Z600HEK is one such laptop. >How-To-Repeat: Use the apm(8) tool to display APM BIOS battery information periodically, and notice that it is incorrect. >Fix: The attached patch introduces a new kernel compile option which is currently activated by adding the following line to the kernel configuration file before compilation: makeoptions APM_SWAB_BATT_MINUTES=1 --- apm-vaio-batt-time.patch begins here --- --- sys/i386/apm/apm.c.orig Tue Sep 3 11:21:30 2002 +++ sys/i386/apm/apm.c Tue Sep 3 11:35:27 2002 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -633,7 +634,13 @@ if (sc->bios.r.edx == 0xffff) /* Time is unknown */ app->ap_batt_time = -1; else if (sc->bios.r.edx & 0x8000) /* Time is in minutes */ +#if defined(APM_SWAB_BATT_MINUTES) + /* BIOS reports minutes incorrectly */ + app->ap_batt_time = __byte_swap_word(sc->bios.r.edx) | 0x8000; + app->ap_batt_time *= 60; +#else app->ap_batt_time = (sc->bios.r.edx & 0x7fff) * 60; +#endif else /* Time is in seconds */ app->ap_batt_time = sc->bios.r.edx; --- apm-vaio-batt-time.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message