Some machines (eg VMs running in VMware) display hundreds of wakeup devices,
polluting dmesg output with many lines of output. One VM dmesg I was shown
indicated 816 wakeup devices.
Since it is unlikely that any real machines have more than 16 wakeup devices,
truncate the count at 16, and after that print '[...]' indicating there are
more. On a standard i386/amd64 console, this is about 1.5 - 2 lines of
dmesg output.
This was requested by reyk@ and I put this diff together at the hackathon,
but I'm not particularly attached to it one way or the other. If enough
people think it's a good idea, I can commit it.
-ml
Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.243
diff -a -u -r1.243 acpi.c
--- dev/acpi/acpi.c 18 Apr 2013 18:30:41 -0000 1.243
+++ dev/acpi/acpi.c 31 May 2013 20:33:20 -0000
@@ -629,7 +629,7 @@
struct acpi_rsdp *rsdp;
struct acpi_q *entry;
struct acpi_dsdt *p_dsdt;
- int idx;
+ int idx, wakeup_dev_ct;
#ifndef SMALL_KERNEL
struct acpi_wakeq *wentry;
struct device *dev;
@@ -796,10 +796,15 @@
#ifndef SMALL_KERNEL
/* Display wakeup devices and lowest S-state */
+ wakeup_dev_ct = 0;
printf("%s: wakeup devices", DEVNAME(sc));
SIMPLEQ_FOREACH(wentry, &sc->sc_wakedevs, q_next) {
- printf(" %.4s(S%d)", wentry->q_node->name,
- wentry->q_state);
+ if (wakeup_dev_ct < 16)
+ printf(" %.4s(S%d)", wentry->q_node->name,
+ wentry->q_state);
+ else if (wakeup_dev_ct == 16)
+ printf(" [...]");
+ wakeup_dev_ct ++;
}
printf("\n");