From owner-freebsd-acpi@FreeBSD.ORG Wed Dec 10 01:06:51 2014 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABADA1AA for ; Wed, 10 Dec 2014 01:06:51 +0000 (UTC) Received: from smtp1.ms.mff.cuni.cz (smtp1.ms.mff.cuni.cz [IPv6:2001:718:1e03:801::4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FB1694 for ; Wed, 10 Dec 2014 01:06:50 +0000 (UTC) Received: from [10.135.106.47] (ip-37-188-136-3.eurotel.cz [37.188.136.3]) by smtp1.ms.mff.cuni.cz (8.14.9/8.14.9) with ESMTP id sBA16YQF074697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=OK) for ; Wed, 10 Dec 2014 02:06:47 +0100 (CET) (envelope-from dan@obluda.cz) Message-ID: <54879C94.1090800@obluda.cz> Date: Wed, 10 Dec 2014 02:06:28 +0100 From: Dan Lukes User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:33.0) Gecko/20100101 Firefox/33.0 SeaMonkey/2.30 MIME-Version: 1.0 CC: "freebsd-acpi@freebsd.org" Subject: Re: ENXIOing non-present battery References: <54840781.70603@freebsd.org> <54862F5E.4040909@freebsd.org> <5486D326.5080708@freebsd.org> In-Reply-To: <5486D326.5080708@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 01:06:51 -0000 Colin Percival wrote: > The hald code uses hw.acpi.battery.units to see how many batteries there are, then reads the _BIF data via ioctl; the "state" > isn't even in _BIF. ACPI specification 3.0a par. 10.2.1 : ------------- ... Unlike most other devices, when a battery is inserted or removed from the system, the device itself (the battery bay) is still considered to be present in the system. For most systems, the _STA for this device will always return a value with bits 0-3 set and will toggle bit 4 to indicate the actual presence of a battery (see section 6.3.7, "_STA [Status]"). When this insertion or removal occurs, the AML code handler for this event should issue a Notify(battery_device, 0x81) to indicate that the static battery information has changed. For systems that have battery slots in a docking station or batteries that cannot be surprise-removed, it may be beneficial or necessary to indicate that the entire device has been removed. In this case, the standard methods and notifications described in section 6.3, "Device Insertion, Removal, and Status Objects," should be used. ------------- It seems that hald is broken as it doesn't handle properly both cases. It should query bit 4 of _STA. Dan