Re: ACPI programming under FreeBSD?
Hi, I have a very simple program that does exactly this using sysctl's. Find it attached. ACPI developers, there is alot more information available in the kernel about ACPI that we don't export to userland yet. Do you think we should do that using more sysctl's or should we implement some ioctl's on /dev/acpi to retrieve the information? Mark On Tue, Oct 01, 2002 at 04:23:00PM -0400, Craig Rodrigues wrote: Hi, I am interested in retrieving power statistics type of information from a system running FreeBSD. I am interested in information such as: power consumed, temperature, percentage of battery available, etc. Is it possible to do this with ACPI, and if so, are there any examples of how to gather this information at the user-level? How stable is ACPI support in -STABLE and -CURRENT for this kind of work? Thanks. -- Craig Rodrigues http://www.gis.net/~craigr [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message -- Mark SantcroosRIPE Network Coordination Centre http://www.ripe.net/home/mark/New Projects Group/TTM #define KELVIN_TO_CELSIUS(t)((t-2732+5)/10) #include stdio.h int main() { int ret; int intbuf; size_t len; ret=sysctlbyname(hw.acpi.thermal.tz0.temperature,intbuf,len,NULL,0); if(ret==0) printf(tz0 temperarture: %d C\n,KELVIN_TO_CELSIUS(intbuf)); ret=sysctlbyname(hw.acpi.thermal.tz0._CRT,intbuf,len,NULL,0); if(ret==0) printf(tz0 crit temperarture: %d C\n,KELVIN_TO_CELSIUS(intbuf)); ret=sysctlbyname(hw.acpi.acline,intbuf,len,NULL,0); if(ret==0) printf(AC Line status: %s\n,intbuf?online:offline); ret=sysctlbyname(hw.acpi.battery.units,intbuf,len,NULL,0); if(ret==0) printf(Number of battery units: %d\n,intbuf); ret=sysctlbyname(hw.acpi.battery.state,intbuf,len,NULL,0); if(ret==0) printf(Battery state: %d\n,intbuf); ret=sysctlbyname(hw.acpi.battery.life,intbuf,len,NULL,0); if(ret==0) printf(Remaining battery life: %d%%\n,intbuf); ret=sysctlbyname(hw.acpi.battery.time,intbuf,len,NULL,0); if(ret==0) printf(Remaining battery time: %d:%d\n,intbuf/60,intbuf%60); printf(crit: %d\n,KELVIN_TO_CELSIUS(3732)); return(0); }
Re: ACPI programming under FreeBSD?
Mark Santcroos [EMAIL PROTECTED] wrote: ACPI developers, there is alot more information available in the kernel about ACPI that we don't export to userland yet. Do you think we should do that using more sysctl's or should we implement some ioctl's on /dev/acpi to retrieve the information? I'm not an ACPI developer, but I really like the sysctl interface, because it enables you to retrieve information from within scripts easily. For ioctls you would have to write a separate tool to be able to access it. Just my 0.02 Euro. Regards Oliver -- Oliver Fromme, secnetix GmbH Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. All that we see or seem is just a dream within a dream (E. A. Poe) To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: ACPI programming under FreeBSD?
Original Message On 10/2/02, 12:34:49 PM, Oliver Fromme [EMAIL PROTECTED] wrote regarding Re: ACPI programming under FreeBSD?: Mark Santcroos [EMAIL PROTECTED] wrote: ACPI developers, there is alot more information available in the kernel about ACPI that we don't export to userland yet. Do you think we should do that using more sysctl's or should we implement some ioctl's on /dev/acpi to retrieve the information? I'm not an ACPI developer, but I really like the sysctl interface, because it enables you to retrieve information from within scripts easily. For ioctls you would have to write a separate tool to be able to access it. I think the list of sysctl entries is pretty long as it is. Just my 0.02 Euro. Just my 25 øre (or 0.25 kroner). Br socketd To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
ACPI programming under FreeBSD?
Hi, I am interested in retrieving power statistics type of information from a system running FreeBSD. I am interested in information such as: power consumed, temperature, percentage of battery available, etc. Is it possible to do this with ACPI, and if so, are there any examples of how to gather this information at the user-level? How stable is ACPI support in -STABLE and -CURRENT for this kind of work? Thanks. -- Craig Rodrigues http://www.gis.net/~craigr [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: ACPI programming under FreeBSD?
Hi, I am interested in retrieving power statistics type of information from a system running FreeBSD. I am interested in information such as: power consumed, temperature, percentage of battery available, etc. Is it possible to do this with ACPI, and if so, are there any examples of how to gather this information at the user-level? Yes, you can get them via sysctl, like % sysctl hw.acpi hw.acpi.power_button_state: S5 hw.acpi.sleep_button_state: S4 hw.acpi.lid_switch_state: NONE hw.acpi.standby_state: S4 hw.acpi.suspend_state: S4 hw.acpi.sleep_delay: 0 hw.acpi.s4bios: 1 hw.acpi.verbose: 0 hw.acpi.cpu.max_speed: 8 hw.acpi.cpu.current_speed: 8 hw.acpi.cpu.performance_speed: 8 hw.acpi.cpu.economy_speed: 8 hw.acpi.thermal.min_runtime: 300 hw.acpi.thermal.polling_rate: 30 hw.acpi.thermal.tz0.temperature: 3262 hw.acpi.thermal.tz0.active: -1 hw.acpi.thermal.tz0.thermal_flags: 0 hw.acpi.thermal.tz0._PSV: -1 hw.acpi.thermal.tz0._HOT: -1 hw.acpi.thermal.tz0._CRT: 3652 hw.acpi.thermal.tz0._ACx: 3372 -1 -1 -1 -1 -1 -1 -1 -1 -1 hw.acpi.acline: 0 hw.acpi.battery.life: 99 hw.acpi.battery.time: 357 hw.acpi.battery.state: 1 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 30 I think my fivamon (Monitor for ACPI and Crusoe Longrun info.) will be an example of application development. It's diff against wmmon Dock. http://people.freebsd.org/~iwasaki/acpi/fivamon-20011124.diff http://people.freebsd.org/~iwasaki/acpi/fivamon-1.gif http://people.freebsd.org/~iwasaki/acpi/fivamon-2.gif http://people.freebsd.org/~iwasaki/acpi/fivamon-3.gif How stable is ACPI support in -STABLE and -CURRENT for this kind of work? Currently ACPI support is available in only -CURRENT. But John Baldwin ([EMAIL PROTECTED]) has patches for -STABLE. The stability is depending on what machine you have, I think. If you have the same machine with ACPI developer, the machine is supported very well :-) Thanks To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message