From owner-freebsd-acpi@freebsd.org Thu Oct 24 02:32:25 2019 Return-Path: Delivered-To: freebsd-acpi@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAB88172EAB for ; Thu, 24 Oct 2019 02:32:25 +0000 (UTC) (envelope-from takawata@sana.init-main.com) Received: from sana.init-main.com (104.194.138.210.bn.2iij.net [210.138.194.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "amnesiac", Issuer "amnesiac" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB9047Qhz48VT for ; Thu, 24 Oct 2019 02:32:19 +0000 (UTC) (envelope-from takawata@sana.init-main.com) Received: from sana.init-main.com (localhost [127.0.0.1]) by sana.init-main.com (8.15.2/8.15.2) with ESMTPS id x9O2JBwe054048 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 24 Oct 2019 11:19:21 +0900 (JST) (envelope-from takawata@sana.init-main.com) Received: (from takawata@localhost) by sana.init-main.com (8.15.2/8.15.2/Submit) id x9O2J9ro054047; Thu, 24 Oct 2019 11:19:09 +0900 (JST) (envelope-from takawata) Date: Thu, 24 Oct 2019 11:19:08 +0900 From: Takanori Watanabe To: Namkhai Bourquin , freebsd-acpi@freebsd.org Subject: Re: ACPI battery states Message-ID: <20191024021908.GA54003@sana.init-main.com> References: <8Hee8PdEep7hhBhELnaZ4c6FiJWkyOu4FGkuuGZ78BNs0r3SNb7IUrnBsHnc02VaiZNvQpWTkpVzu3QVo9faex3JljL2qP4fpcjxTrjYZRY=@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8Hee8PdEep7hhBhELnaZ4c6FiJWkyOu4FGkuuGZ78BNs0r3SNb7IUrnBsHnc02VaiZNvQpWTkpVzu3QVo9faex3JljL2qP4fpcjxTrjYZRY=@protonmail.com> User-Agent: Mutt/1.12.0 (2019-05-25) X-Rspamd-Queue-Id: 46zB9047Qhz48VT X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of takawata@sana.init-main.com has no SPF policy when checking 210.138.194.104) smtp.mailfrom=takawata@sana.init-main.com X-Spamd-Result: default: False [-1.19 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.970,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.43)[ipnet: 210.138.0.0/16(-3.87), asn: 2497(1.75), country: JP(-0.00)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[init-main.com]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-0.995,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[takawata@init-main.com,takawata@sana.init-main.com]; FREEMAIL_TO(0.00)[protonmail.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:2497, ipnet:210.138.0.0/16, country:JP]; FROM_NEQ_ENVFROM(0.00)[takawata@init-main.com,takawata@sana.init-main.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:32:25 -0000 On Thu, Oct 24, 2019 at 01:31:01AM +0000, Namkhai Bourquin via freebsd-acpi wrote: > Hi all! I'm writing a script to get battery status and capacity, and I'm using hw.acpi.battery for that. But I can't find a reference as to which states hw.acpi.battery.state supports. Not in DuckDuckGo, nor google, nor the mailing lists archive, nothing. I only managed to discover this by discharging the battery and monitoring: > state: 0 = unknow? > state: 1 = discharging > state: 2 = charging > state: 5 = discharging critical (life < 6) > state: 4 = same as 0, but with critical charge? > state: 6 = charging critical This is originally raw value of _BST which is specific ACPI method for control method battery, but smart battery device also simulate it. The bit macro is in /usr/include/dev/acpica/acpiio.h . #define ACPI_BATT_STAT_DISCHARG 0x0001 #define ACPI_BATT_STAT_CHARGING 0x0002 #define ACPI_BATT_STAT_CRITICAL 0x0004 > I can't find anything on the man pages either. > Should this be documented, either on a man page or the sysctl's tunable description? It will be good.