Subject: kern/36615: acpitz(4) prints "-273.-3C"
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Tetsuya Isaki <isaki@par.odn.ne.jp>
List: netbsd-bugs
Date: 07/08/2007 10:20:00
>Number: 36615
>Category: kern
>Synopsis: acpitz(4) prints "-273.-3C"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jul 08 10:20:00 +0000 2007
>Originator: Tetsuya Isaki
>Release: NetBSD 3.0.2
>Organization:
>Environment:
No uname because I have not had the board any longer.
>Description:
I found a strange message in dmesg on VIA C7 board
using 3.0.2/i386.
acpitz0: critical 60.0C passive -273.-3C
^^^^^^^^
It has 2 problem, I think.
The first one is format issue ("-273.-3").
And second one is that -273.3C is -0.1K. That is,
it's called as acpitz_celcius_string(-1).
>How-To-Repeat:
>Fix:
How about this? This patch is for -current.
However, I cannot confirm it, because I have not
had the board any longer.
--- sys/dev/acpi/acpi_tz.c 1 Jul 2007 07:37:12 -0000 1.22
+++ sys/dev/acpi/acpi_tz.c 8 Jul 2007 05:38:18 -0000
@@ -314,9 +314,10 @@
acpitz_celcius_string(int dk)
{
static char buf[10];
+ int dc;
- snprintf(buf, sizeof(buf), "%d.%d", (dk - ATZ_ZEROC) / 10,
- (dk - ATZ_ZEROC) % 10);
+ dc = dk - ATZ_ZEROC;
+ snprintf(buf, sizeof(buf), "%d.%d", dc / 10, abs(dc) % 10);
return buf;
}
--- sys/dev/acpi/acpi_tz.c 1 Jul 2007 07:37:12 -0000 1.22
+++ sys/dev/acpi/acpi_tz.c 8 Jul 2007 06:02:03 -0000
@@ -491,7 +491,7 @@
acpitz_celcius_string(sc->sc_zone.hot));
if (sc->sc_zone.psv != ATZ_TMP_INVALID)
printf(" passive %sC",
- acpitz_celcius_string(sc->sc_zone.tmp));
+ acpitz_celcius_string(sc->sc_zone.psv));
printf("\n");
}