Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi fix dmesg printing.



details:   https://anonhg.NetBSD.org/src/rev/e4b47bf2173b
branches:  trunk
changeset: 754005:e4b47bf2173b
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 16 01:52:54 2010 +0000

description:
fix dmesg printing.

diffstat:

 sys/dev/acpi/acpi_bat.c |  44 ++++++++++++++++++++++++++++++--------------
 sys/dev/acpi/acpi_tz.c  |  44 ++++++++++++++++++++++++++------------------
 2 files changed, 56 insertions(+), 32 deletions(-)

diffs (156 lines):

diff -r 169891d9269a -r e4b47bf2173b sys/dev/acpi/acpi_bat.c
--- a/sys/dev/acpi/acpi_bat.c   Fri Apr 16 01:45:33 2010 +0000
+++ b/sys/dev/acpi/acpi_bat.c   Fri Apr 16 01:52:54 2010 +0000
@@ -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",
+           elm[ACPIBAT_BIF_OEM].String.Pointer,
+           elm[ACPIBAT_BIF_TYPE].String.Pointer, tech);
+
+       if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0] ||
+           elm[ACPIBAT_BIF_MODEL].String.Pointer[0]) {
+               int comma;
+               aprint_verbose_dev(dv, "");
 
-       aprint_normal_dev(dv, "%s %s %s battery\n", tech,
-           elm[ACPIBAT_BIF_OEM].String.Pointer,
-           elm[ACPIBAT_BIF_TYPE].String.Pointer);
+               if (elm[ACPIBAT_BIF_SERIAL].String.Pointer[0]) {
+                       aprint_verbose("serial number %s",
+                           elm[ACPIBAT_BIF_SERIAL].String.Pointer);
+                       comma = 1;
+               } else
+                       comma = 0;
 
-       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_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);
 }
diff -r 169891d9269a -r e4b47bf2173b sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c    Fri Apr 16 01:45:33 2010 +0000
+++ b/sys/dev/acpi/acpi_tz.c    Fri Apr 16 01:52:54 2010 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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,31 +509,39 @@
        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));
-
-               if (sc->sc_zone.hot != ATZ_TMP_INVALID)
-                       aprint_verbose(" hot %s C",
-                           acpitz_celcius_string(sc->sc_zone.hot));
+                       comma = 1;
+               }
 
-               if (sc->sc_zone.psv != ATZ_TMP_INVALID)
-                       aprint_normal(" passive %s C",
-                           acpitz_celcius_string(sc->sc_zone.psv));
-       }
+               if (sc->sc_zone.hot != ATZ_TMP_INVALID) {
+                       aprint_verbose("%shot %s C", comma ? ", " : "",
+                           acpitz_celcius_string(sc->sc_zone.hot));
+                       comma = 1;
+               }
 
-       if (valid_levels == 0) {
-               sc->sc_flags |= ATZ_F_PASSIVEONLY;
+               if (sc->sc_zone.psv != ATZ_TMP_INVALID) {
+                       aprint_normal("%spassive %s C", comma ? ", " : "",
+                           acpitz_celcius_string(sc->sc_zone.psv));
+                       comma = 1;
+               }
 
-               if (sc->sc_first)
-                       aprint_verbose(", passive cooling");
+               if (valid_levels == 0) {
+                       sc->sc_flags |= ATZ_F_PASSIVEONLY;
+
+                       if (sc->sc_first)
+                               aprint_verbose("%spassive cooling", comma ?
+                                   ", " : "");
+               }
+
+               aprint_verbose("\n");
        }
 
-       if (verbose != 0)
-               aprint_verbose("\n");
-
        for (i = 0; i < ATZ_NLEVELS; i++)
                acpitz_sane_temp(&sc->sc_zone.ac[i]);
 



Home | Main Index | Thread Index | Old Index