From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 17 06:12:46 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79012574; Tue, 17 Jun 2014 06:12:46 +0000 (UTC) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (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 E63682895; Tue, 17 Jun 2014 06:12:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id s5H6CeMe054143; Tue, 17 Jun 2014 16:12:40 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Tue, 17 Jun 2014 16:12:40 +1000 (EST) From: Ian Smith To: CeDeROM Subject: Re: sysctl hw.acpi.acline In-Reply-To: Message-ID: <20140617153436.G609@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Mailman-Approved-At: Tue, 17 Jun 2014 11:30:27 +0000 Cc: freebsd-hackers@freebsd.org, freebsd-acpi@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2014 06:12:46 -0000 On Mon, 16 Jun 2014 16:36:42 +0200, CeDeROM wrote: > One application that I am porting needs to know the power supply > information from the system. I thought using SYSCTL + ACPI would be > the simplest and elegant way. But, I found out that information on the > power supply is only available on the laptop machines, while on the > desktop machines it does not apply. According to the "man acpi", the > "hw.acpi.acline" oid tells the AC line state, so I guess desktop > should always tell 1, but there is no such oid on my desktop.. > > Is this a bug or feature? :-) Definitely a feature. The absence of this OID is a sure way to tell if the machine you're talking to - which may be remote, so you may not know how it's being powered - is or is not (capable of) running on battery. > How can I tell the power source on my FreeBSD (i.e. AC, Battery, UPS)? > > man acpi: > ... > hw.acpi.acline > AC line state (1 means online, 0 means on battery power). > > root@hexagon:~ # sysctl hw.acpi.acline > sysctl: unknown oid 'hw.acpi.acline': No such file or directory So this is an AC powered machine. And it is, most certainly, ON. Perhaps what you need to do is fit one of these to your machine: DED (pronounced "dead") (dark emitting diode) A variation of LED technology used exclusively by the CIA for clandestine equipment. Also popular as power-off indicators. http://www.rane.com/par-d.html You could also add a DDR (dark dependant resistor) circuit to ring a bell whenever the DED is emitting, just to be sure it really is OFF. You should probably avoid using the new super-dark DEDs or you may find your room plunged into impenetrable darkness whenever power goes off. Seriously for a moment: if you do have a UPS you'll need to interrogate the UPS software - which varies for different brands of UPS so can't be integrated with the BIOS/ACPI - for its state, as David mentioned. cheers, Ian