Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Print correct temperature value, and properly d...



details:   https://anonhg.NetBSD.org/src/rev/abd5c85e7ceb
branches:  trunk
changeset: 752189:abd5c85e7ceb
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Feb 18 14:10:15 2010 +0000

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

Resolves PR kern/36615

diffstat:

 sys/dev/acpi/acpi_tz.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 8578ceea7846 -r abd5c85e7ceb sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c    Thu Feb 18 14:00:39 2010 +0000
+++ b/sys/dev/acpi/acpi_tz.c    Thu Feb 18 14:10:15 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2003 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -355,9 +355,11 @@
 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 = abs(dk - ATZ_ZEROC);
+       snprintf(buf, sizeof(buf), "%s%d.%d", (dk >= ATZ_ZEROC)?"":"-",
+               dc / 10, dc % 10);
 
        return buf;
 }
@@ -526,7 +528,7 @@
                            acpitz_celcius_string(sc->sc_zone.hot));
                if (sc->sc_zone.psv != ATZ_TMP_INVALID)
                        aprint_normal(" passive %sC",
-                           acpitz_celcius_string(sc->sc_zone.tmp));
+                           acpitz_celcius_string(sc->sc_zone.psv));
        }
 
        if (valid_levels == 0) {



Home | Main Index | Thread Index | Old Index