NetBSD Problem Report #36615

From isaki@pastel-flower.jp  Sun Jul  8 10:16:54 2007
Return-Path: <isaki@pastel-flower.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 1F14D63B874
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Jul 2007 10:16:54 +0000 (UTC)
Message-Id: <200707080916292689700004MA21@nm04mta.dion.ne.jp>
Date: Sun, 08 Jul 2007 18:16:25 +0900
From: Tetsuya Isaki <isaki@par.odn.ne.jp>
Reply-To: isaki@par.odn.ne.jp
To: gnats-bugs@NetBSD.org
Subject: acpitz(4) prints "-273.-3C"
X-Send-Pr-Version: 3.95

>Number:         36615
>Category:       kern
>Synopsis:       acpitz(4) prints "-273.-3C"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 08 10:20:00 +0000 2007
>Closed-Date:    Thu Feb 18 14:11:41 +0000 2010
>Last-Modified:  Thu Feb 18 14:15:02 +0000 2010
>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");
 	}


>Release-Note:

>Audit-Trail:
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/36615: acpitz(4) prints "-273.-3C"
Date: Sun, 8 Jul 2007 11:53:11 +0100

 On Sun, Jul 08, 2007 at 10:20:00AM +0000, Tetsuya Isaki wrote:
 > >Number:         36615
 > >Synopsis:       acpitz(4) prints "-273.-3C"
 >  
 > -	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);

 That still gets the result wrong for -ve values.

 	David

 -- 
 David Laight: david@l8s.co.uk

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Thu, 18 Feb 2010 14:11:41 +0000
Responsible-Changed-Why:
It's mine.


State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Thu, 18 Feb 2010 14:11:41 +0000
State-Changed-Why:
Modified version of patch applied.


From: Paul Goyette <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36615 CVS commit: src/sys/dev/acpi
Date: Thu, 18 Feb 2010 14:10:15 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Thu Feb 18 14:10:15 UTC 2010

 Modified Files:
 	src/sys/dev/acpi: acpi_tz.c

 Log Message:
 Print correct temperature value, and properly display negative temperatures.

 Resolves PR kern/36615


 To generate a diff of this commit:
 cvs rdiff -u -r1.58 -r1.59 src/sys/dev/acpi/acpi_tz.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.