sysctl hw.acpi.acline

Ian Smith smithi at
Tue Jun 17 06:12:46 UTC 2014

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 at 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.

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

More information about the freebsd-acpi mailing list