Module Name: src Committed By: christos Date: Fri Apr 16 01:52:54 UTC 2010
Modified Files: src/sys/dev/acpi: acpi_bat.c acpi_tz.c Log Message: fix dmesg printing. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/dev/acpi/acpi_bat.c cvs rdiff -u -r1.65 -r1.66 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.
Modified files: Index: src/sys/dev/acpi/acpi_bat.c diff -u src/sys/dev/acpi/acpi_bat.c:1.100 src/sys/dev/acpi/acpi_bat.c:1.101 --- src/sys/dev/acpi/acpi_bat.c:1.100 Thu Apr 15 03:02:24 2010 +++ src/sys/dev/acpi/acpi_bat.c Thu Apr 15 21:52:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_bat.c,v 1.100 2010/04/15 07:02:24 jruoho Exp $ */ +/* $NetBSD: acpi_bat.c,v 1.101 2010/04/16 01:52:54 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.100 2010/04/15 07:02:24 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.101 2010/04/16 01:52:54 christos Exp $"); #include <sys/param.h> #include <sys/condvar.h> @@ -424,7 +424,7 @@ static void acpibat_print_info(device_t dv, ACPI_OBJECT *elm) { - const char *tech, *unit = "Wh"; + const char *tech, *unit; int i; for (i = ACPIBAT_BIF_OEM; i > ACPIBAT_BIF_GRANULARITY2; i--) { @@ -437,18 +437,30 @@ } tech = (elm[ACPIBAT_BIF_TECHNOLOGY].Integer.Value != 0) ? - "secondary (rechargeable)" : "primary (non-rechargeable)"; + "rechargeable" : "non-rechargeable"; - if ((elm[ACPIBAT_BIF_UNIT].Integer.Value & ACPIBAT_PWRUNIT_MA) != 0) - unit = "Ah"; - - aprint_normal_dev(dv, "%s %s %s battery\n", tech, + aprint_normal_dev(dv, "%s %s %s battery\n", elm[ACPIBAT_BIF_OEM].String.Pointer, - elm[ACPIBAT_BIF_TYPE].String.Pointer); + elm[ACPIBAT_BIF_TYPE].String.Pointer, tech); - aprint_verbose_dev(dv, "serial number %s, model number %s\n", - elm[ACPIBAT_BIF_SERIAL].String.Pointer, - elm[ACPIBAT_BIF_MODEL].String.Pointer); + if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0] || + elm[ACPIBAT_BIF_MODEL].String.Pointer[0]) { + int comma; + aprint_verbose_dev(dv, ""); + + if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0]) { + aprint_verbose("serial number %s", + elm[ACPIBAT_BIF_SERIAL].String.Pointer); + comma = 1; + } else + comma = 0; + + if (elm[ACPIBAT_BIF_MODEL].String.Pointer[0]) + aprint_verbose("%smodel number %s", + comma ? ", " : "", + elm[ACPIBAT_BIF_MODEL].String.Pointer); + aprint_verbose("\n"); + } #define SCALE(x) (((int)x) / 1000000), ((((int)x) % 1000000) / 1000) @@ -463,8 +475,12 @@ * Granularity 2. "Battery capacity granularity between warning * and full in [mAh] or [mWh]. [...]" */ - aprint_verbose_dev(dv, - "granularity 1. %d.%03d %s, granularity 2. %d.%03d %s\n", + if ((elm[ACPIBAT_BIF_UNIT].Integer.Value & ACPIBAT_PWRUNIT_MA) != 0) + unit = "Ah"; + else + unit = "Wh"; + aprint_verbose_dev(dv, "low->warn granularity: %d.%03d%s, " + "warn->full granularity: %d.%03d%s\n", SCALE(elm[ACPIBAT_BIF_GRANULARITY1].Integer.Value * 1000), unit, SCALE(elm[ACPIBAT_BIF_GRANULARITY2].Integer.Value * 1000), unit); } Index: src/sys/dev/acpi/acpi_tz.c diff -u src/sys/dev/acpi/acpi_tz.c:1.65 src/sys/dev/acpi/acpi_tz.c:1.66 --- src/sys/dev/acpi/acpi_tz.c:1.65 Thu Apr 15 03:02:24 2010 +++ src/sys/dev/acpi/acpi_tz.c Thu Apr 15 21:52:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_tz.c,v 1.65 2010/04/15 07:02:24 jruoho Exp $ */ +/* $NetBSD: acpi_tz.c,v 1.66 2010/04/16 01:52:54 christos Exp $ */ /* * Copyright (c) 2003 Jared D. McNeill <jmcne...@invisible.ca> @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.65 2010/04/15 07:02:24 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.66 2010/04/16 01:52:54 christos Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -509,30 +509,38 @@ acpitz_sane_temp(&sc->sc_zone.psv); if (verbose != 0) { + int comma = 0; + aprint_verbose_dev(dv, ""); - if (sc->sc_zone.crt != ATZ_TMP_INVALID) + if (sc->sc_zone.crt != ATZ_TMP_INVALID) { aprint_verbose("critical %s C", acpitz_celcius_string(sc->sc_zone.crt)); + comma = 1; + } - if (sc->sc_zone.hot != ATZ_TMP_INVALID) - aprint_verbose(" hot %s C", + if (sc->sc_zone.hot != ATZ_TMP_INVALID) { + aprint_verbose("%shot %s C", comma ? ", " : "", acpitz_celcius_string(sc->sc_zone.hot)); + comma = 1; + } - if (sc->sc_zone.psv != ATZ_TMP_INVALID) - aprint_normal(" passive %s C", + if (sc->sc_zone.psv != ATZ_TMP_INVALID) { + aprint_normal("%spassive %s C", comma ? ", " : "", acpitz_celcius_string(sc->sc_zone.psv)); - } + comma = 1; + } - if (valid_levels == 0) { - sc->sc_flags |= ATZ_F_PASSIVEONLY; + if (valid_levels == 0) { + sc->sc_flags |= ATZ_F_PASSIVEONLY; - if (sc->sc_first) - aprint_verbose(", passive cooling"); - } + if (sc->sc_first) + aprint_verbose("%spassive cooling", comma ? + ", " : ""); + } - if (verbose != 0) aprint_verbose("\n"); + } for (i = 0; i < ATZ_NLEVELS; i++) acpitz_sane_temp(&sc->sc_zone.ac[i]);