Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Feb 2013 22:13:56 -0800
From:      Kevin Oberman <rkoberman@gmail.com>
To:        Dmitry Sarkisov <ait.mlist@gmail.com>
Cc:        freebsd-acpi@freebsd.org
Subject:   Re: acpi_termal sysctl interface strange temperature value
Message-ID:  <CAN6yY1uPiBh6Dv-wsLq1DMcXL%2BD%2Bq_=7s%2B8JbsLk15sN-ZQ-aw@mail.gmail.com>
In-Reply-To: <20130225014000.GA6413@aperturescience.org>
References:  <20130225014000.GA6413@aperturescience.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 24, 2013 at 5:40 PM, Dmitry Sarkisov <ait.mlist@gmail.com>wrote:

> Hello,
>
> I'm trying to poll cpu temperature with the following code:
>
>
> #define TEMP_MIB "hw.acpi.thermal.tz0.temperature"
>
>        size_t len;
>        int t;
>
>        len = sizeof(t);
>        bzero(temp, len);
>
>        if(sysctlbyname(TEMP_MIB, &t, &len, NULL, 0) == -1 ){
>           perror("sysctl");
>           return -1;
>         }else{
>           printf("%d\n", t);
>         }
>
> Values I'm geting are like this:
> 3732
>
> while actual is:
>
>  sysctl -n hw.acpi.thermal.tz0.temperature
> 55.0C
>

ACPI does not report temperature in degrees Celsius, but in tenths of a
degree Kelvin.  So both agree.

When ACPI was first introduced into head (v5?), the  sysctl  reported the
raw number, but the code was later modified to provide a more human
friendly value. Directly probing ACPI for temperature still returns the raw
value.
-- 
R. Kevin Oberman, Network Engineer
E-mail: rkoberman@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN6yY1uPiBh6Dv-wsLq1DMcXL%2BD%2Bq_=7s%2B8JbsLk15sN-ZQ-aw>