Re: sysctl hw.acpi.acline

2014-06-18 Thread CeDeROM
On Wed, Jun 18, 2014 at 8:28 AM, Mitsuru IWASAKI  wrote:
>> There is no information in the ACPI Manual that the OID's are optional
>> and may not exist in some cases. This is exactly the problem, an
>> undefined and undocumented situation. Maybe its just worth putting a
>> note :-)
>
> OK, how about adding the following line?
> 
> Note that this OID exists only if there is a ACPI Device ID "ACPI0003" in 
> ACPI Namespace of the system.
> 

Hello Mitsuru! :-) I wanted to ask the list and make sure, in general,
if OID can be optional/missing depending on the hardware capabilities.
It looks like things are like that - some other OID are missing as
well depending on the hardware. I think one general remark could be
put into acpi and sysctl manual pages, something like:

"Note that some OID will be available only if given hardware supports
them, on a different hardware these will be missing which means that
feature is not supported."


> Unfortunately, UPS is not covered by ACPI specification.  I think that
> new OID would be needed in generic place (not under hw.acpi) in order
> to get the state of power sources.
> In that case, hw.acpi.battery should be moved to new place too.

I thought acline would be such place - it is even specified in the
manual (unlike battery) :-) Now I know assumption must be made that is
acline oid is not available then we have a dekstop. But I dont really
like assumptions, thats why I prefered to ask first :-)

Thank you! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-17 Thread Mitsuru IWASAKI
Hi,

> > ACPI have tons of optional stuff that isn't required to be present,
> > and apparently acline is one of them.  Also, acline is only useful
> > if there are multiple power sources, what if you have a desktop
> > machine always running off a battery, if we defaulted acline=1, then
> > you'd complain that the status is wrong... :)
> 
> There is no information in the ACPI Manual that the OID's are optional
> and may not exist in some cases. This is exactly the problem, an
> undefined and undocumented situation. Maybe its just worth putting a
> note :-)
> 
> "
>  hw.acpi.acline
>  AC line state (1 means online, 0 means on battery power).
> "

OK, how about adding the following line?

Note that this OID exists only if there is a ACPI Device ID "ACPI0003" in ACPI 
Namespace of the system.


> I expect code based on this oid to work on both desktop and laptop
> with no additional guessing. For me this manual information means that
> acline oid is always available, and will show 1 in case of desktop
> where no battery (maybe no UPS as well) is available. There is no
> information that this oid is optional. For desktop/server a battery
> power would mean UPS, right, so then I would also expect to see the
> battery charge status information.. but I understand this would be
> more complicated than in a laptop thus may not be implemented. Still,
> I would always expect power source type OID to tell me what is the
> power source, even if there can be only one.

Unfortunately, UPS is not covered by ACPI specification.  I think that
new OID would be needed in generic place (not under hw.acpi) in order
to get the state of power sources.
In that case, hw.acpi.battery should be moved to new place too.

Thanks
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread CeDeROM
On Tue, Jun 17, 2014 at 2:29 AM, John-Mark Gurney  wrote:
> CeDeROM wrote this message on Tue, Jun 17, 2014 at 00:25 +0200:
>> On Tue, Jun 17, 2014 at 12:10 AM, Anthony Jenkins
>>  wrote:
>> > The absence of hw.acpi.battery and child oids probably implies there is no 
>> > battery and the system may be assumed to be on line (A/C) power.
>>
>> Hello Anthony! I would prefer to have that information clearly defined
>> in the manual :-) I guessed that this is a quick fix to first check
>
> Which manual?

man acpi


> ACPI have tons of optional stuff that isn't required to be present,
> and apparently acline is one of them.  Also, acline is only useful
> if there are multiple power sources, what if you have a desktop
> machine always running off a battery, if we defaulted acline=1, then
> you'd complain that the status is wrong... :)

There is no information in the ACPI Manual that the OID's are optional
and may not exist in some cases. This is exactly the problem, an
undefined and undocumented situation. Maybe its just worth putting a
note :-)

"
 hw.acpi.acline
 AC line state (1 means online, 0 means on battery power).
"

I expect code based on this oid to work on both desktop and laptop
with no additional guessing. For me this manual information means that
acline oid is always available, and will show 1 in case of desktop
where no battery (maybe no UPS as well) is available. There is no
information that this oid is optional. For desktop/server a battery
power would mean UPS, right, so then I would also expect to see the
battery charge status information.. but I understand this would be
more complicated than in a laptop thus may not be implemented. Still,
I would always expect power source type OID to tell me what is the
power source, even if there can be only one.

Best regards :-)
Tomek


-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread Ian Smith
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
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread John-Mark Gurney
CeDeROM wrote this message on Tue, Jun 17, 2014 at 00:25 +0200:
> On Tue, Jun 17, 2014 at 12:10 AM, Anthony Jenkins
>  wrote:
> > The absence of hw.acpi.battery and child oids probably implies there is no 
> > battery and the system may be assumed to be on line (A/C) power.
> 
> Hello Anthony! I would prefer to have that information clearly defined
> in the manual :-) I guessed that this is a quick fix to first check

Which manual?

> the OID existence, but if manual tells there is such OID it should be
> there, even if there is no battery, huh? This is why I consider this
> to be a bug :-)

ACPI have tons of optional stuff that isn't required to be present,
and apparently acline is one of them.  Also, acline is only useful
if there are multiple power sources, what if you have a desktop
machine always running off a battery, if we defaulted acline=1, then
you'd complain that the status is wrong... :)

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread CeDeROM
On Tue, Jun 17, 2014 at 12:10 AM, Anthony Jenkins
 wrote:
> The absence of hw.acpi.battery and child oids probably implies there is no 
> battery and the system may be assumed to be on line (A/C) power.

Hello Anthony! I would prefer to have that information clearly defined
in the manual :-) I guessed that this is a quick fix to first check
the OID existence, but if manual tells there is such OID it should be
there, even if there is no battery, huh? This is why I consider this
to be a bug :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread Anthony Jenkins
On 06/16/2014 17:43, CeDeROM wrote:
> On Mon, Jun 16, 2014 at 10:43 PM, Armin Gruner  wrote:
>> it's actually "hw.acpi.battery.state"
>> (the man page is indeed stale)
>> The value of hw.acpi.battery.state
>> 0 means: on AC power
>> 1 means: on battery
>> 2 means: charging
> Hey Armin :-) The same situation here on a desktop I get:
>
> root@hexagon:~ # sysctl hw.acpi.battery.state
> sysctl: unknown oid 'hw.acpi.battery.state': No such file or directory
> root@hexagon:~ # uname -a
> FreeBSD hexagon 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13
> 18:31:10 UTC 2014
> r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>
> Tanks! :-)
> Tomek
>
The absence of hw.acpi.battery and child oids probably implies there is no 
battery and the system may be assumed to be on line (A/C) power.

Anthony
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread CeDeROM
On Mon, Jun 16, 2014 at 10:43 PM, Armin Gruner  wrote:
> it's actually "hw.acpi.battery.state"
> (the man page is indeed stale)
> The value of hw.acpi.battery.state
> 0 means: on AC power
> 1 means: on battery
> 2 means: charging

Hey Armin :-) The same situation here on a desktop I get:

root@hexagon:~ # sysctl hw.acpi.battery.state
sysctl: unknown oid 'hw.acpi.battery.state': No such file or directory
root@hexagon:~ # uname -a
FreeBSD hexagon 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13
18:31:10 UTC 2014
r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Tanks! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: sysctl hw.acpi.acline

2014-06-16 Thread CeDeROM
On Mon, Jun 16, 2014 at 5:32 PM, David Wolfskill  wrote:
> On Mon, Jun 16, 2014 at 04:36:42PM +0200, CeDeROM wrote:
>> ...
>> 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).
>> 
>
> From the perspective of the running system, you should not be able to
> tell (merely from the state of the power supply, at least) whether power
> is being supplied by UPS or "house wiring".
>
> You can make that distinction by querying the state of a UPS, if one is
> connected (and set up to provide power to the system in question).

I am porting from Linux code that use "/sys/class/power_supply/type"
and can tell "Mains", "UPS", or "Battery". It would be nice if FreeBSD
had something similar :-)

>From ACPI manual it seems that "hw.acpi.acline" shoud do the job, but
this OID is not available on desktops.. and this is not noted anywhere
that "hw.acpi.acline" is only available on a laptops.. so I am not
sure if my code should depend on this OID and if this is a bug?

Thanks! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


sysctl hw.acpi.acline

2014-06-16 Thread CeDeROM
Hello world :-)

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? :-)

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
root@hexagon:~ # uname -a
FreeBSD hexagon 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13
18:31:10 UTC 2014
r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Any hints appreciated! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"