From owner-freebsd-acpi@FreeBSD.ORG Mon Feb 25 06:13:57 2013 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4586FC57 for ; Mon, 25 Feb 2013 06:13:57 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-oa0-f41.google.com (mail-oa0-f41.google.com [209.85.219.41]) by mx1.freebsd.org (Postfix) with ESMTP id 026DEF61 for ; Mon, 25 Feb 2013 06:13:56 +0000 (UTC) Received: by mail-oa0-f41.google.com with SMTP id i10so2578008oag.14 for ; Sun, 24 Feb 2013 22:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=bPx4ZXZccbrlYTKhhuuCq9rmXNYIMUsiDZ9hN9ReF9A=; b=tSMGtmlggIzzHFW91wBlMT2sbKdyVBDmcMvaRNLxxRUY6U25nt3xlz2FEcufZvgWk8 JmiAn+B73MMXOqnLACduvb0ndYeaC7U7EbIsITtsPuASBCt5HwYAlX/78Hp/Z8Mr+t27 bDCYzA0xRZXdwFNdqFINab6OLTnZ78kxBQGgSJXRuSdEVqhDf0WykLgiNU+/Zo8aq/Ms 6Kb63Me7hni0kvw2p1nG8kFSTasEc4aNys1ed+oaLou7r+ASxLI97cuJPNJqwEBccxgT LJw9EyDklU5j5TQhu5VhZeGl0UI162JrXVFUi0TKI3DGhskYi8B7ALBMSQ6+UoYBM+OP p1kA== MIME-Version: 1.0 X-Received: by 10.60.19.101 with SMTP id d5mr6265583oee.115.1361772836137; Sun, 24 Feb 2013 22:13:56 -0800 (PST) Sender: kob6558@gmail.com Received: by 10.76.34.197 with HTTP; Sun, 24 Feb 2013 22:13:56 -0800 (PST) In-Reply-To: <20130225014000.GA6413@aperturescience.org> References: <20130225014000.GA6413@aperturescience.org> Date: Sun, 24 Feb 2013 22:13:56 -0800 X-Google-Sender-Auth: CTe4EvGz1ytqhLNTmMzNjyrOqo8 Message-ID: Subject: Re: acpi_termal sysctl interface strange temperature value From: Kevin Oberman To: Dmitry Sarkisov Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-acpi@freebsd.org X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2013 06:13:57 -0000 On Sun, Feb 24, 2013 at 5:40 PM, Dmitry Sarkisov 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