Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jun 2014 16:12:40 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        CeDeROM <cederom@tlen.pl>
Cc:        freebsd-hackers@freebsd.org, freebsd-acpi@freebsd.org
Subject:   Re: sysctl hw.acpi.acline
Message-ID:  <20140617153436.G609@sola.nimnet.asn.au>
In-Reply-To: <CAFYkXj=cN=A7ZRs-N5xoER51=daMaaS4uBCQLpfnOC0=Mg0WuA@mail.gmail.com>
References:  <CAFYkXj=cN=A7ZRs-N5xoER51=daMaaS4uBCQLpfnOC0=Mg0WuA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140617153436.G609>