From owner-freebsd-acpi@FreeBSD.ORG Thu Dec 11 20:56:00 2014 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7535EC61; Thu, 11 Dec 2014 20:56:00 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5077AE4; Thu, 11 Dec 2014 20:56:00 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B250BB93E; Thu, 11 Dec 2014 15:55:58 -0500 (EST) From: John Baldwin To: freebsd-acpi@freebsd.org Subject: Re: ENXIOing non-present battery Date: Thu, 11 Dec 2014 14:08:50 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <54840781.70603@freebsd.org> In-Reply-To: <54840781.70603@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201412111408.50866.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 11 Dec 2014 15:55:58 -0500 (EST) Cc: Colin Percival 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: Thu, 11 Dec 2014 20:56:00 -0000 On Sunday, December 07, 2014 2:53:37 am Colin Percival wrote: > Hi ACPI people, > > On my Dell Latitude E7440 laptop, the ACPI reports two batteries: First > the battery which exists; and second, a "Not Present" battery with zeroed > statistics. FreeBSD, not realizing that this second battery is a complete > myth -- the E7440 only has one battery, and there is nowhere to add another > -- faithfully reports the data from ACPI to userland. > > Unfortunately it causes some problems there; in particular, KDE interprets > it as meaning that the system should have two batteries, and when it sees > that the "second" battery has 0% power remaining it kicks off the "battery > is low, turn the laptop off" code. If that code is disabled, it still > displays the wrong battery-charge-remaining status icons. > > For dealing with such broken ACPIs, it seems like not attaching a non-present > battery would be a good idea. This shouldn't be the default behaviour, since > there are plenty of systems where a non-present battery might be inserted at > a later time; but I see nothing wrong with adding an option. > > The attached patch adds a acpi.cmbat.hide_not_present loader tunable which, > as the name suggests, hides non-present batteries; this is done in the probe > code by returning ENXIO if the tunable is set to a nonzero value and > acpi_BatteryIsPresent returns zero. With this patch and the tunable set my > laptop behaves appropriately; and (aside from wasting a few bytes of memory) > there should be no effect on systems where the tunable is not set. > > Any objections to me committing this? Does setting hint.battery.1.disabled=1 work for you? -- John Baldwin