acpi_termal sysctl interface strange temperature value
Kevin Oberman
rkoberman at gmail.com
Mon Feb 25 06:13:57 UTC 2013
On Sun, Feb 24, 2013 at 5:40 PM, Dmitry Sarkisov <ait.mlist at 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 at gmail.com
More information about the freebsd-acpi
mailing list