diff options
author | njl <njl@FreeBSD.org> | 2006-01-22 01:06:25 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2006-01-22 01:06:25 +0000 |
commit | 94f070e5b3bd141801e27c8a05f9acc6cfe1b592 (patch) | |
tree | e8c1832d02cdbd55270bc3c0c7ce936006a9bfc9 | |
parent | adeddfdcc3a325631ba603f89255c5a8957647c5 (diff) | |
download | FreeBSD-src-94f070e5b3bd141801e27c8a05f9acc6cfe1b592.zip FreeBSD-src-94f070e5b3bd141801e27c8a05f9acc6cfe1b592.tar.gz |
Add a devd(8) event that is sent after the system resumes. This can be
used by utilities to reset moused(8), for example. The syntax is:
!system=kern subsystem=power type=resume
Note that it would be nice to have notification of suspend, but it's more
difficult since there would have to be a method of doing request/ack
to userland and automatically timing out if no response. apm(4) has a
similar mechanism.
MFC after: 2 weeks
-rw-r--r-- | sys/kern/subr_bus.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index b19be54..5610f38 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3597,6 +3597,18 @@ bus_child_location_str(device_t child, char *buf, size_t buflen) return (BUS_CHILD_LOCATION_STR(parent, child, buf, buflen)); } +/* Resume all devices and then notify userland that we're up again. */ +static int +root_resume(device_t dev) +{ + int error; + + error = bus_generic_resume(dev); + if (error == 0) + devctl_notify("kern", "power", "resume", NULL); + return (error); +} + static int root_print_child(device_t dev, device_t child) { @@ -3635,7 +3647,7 @@ static kobj_method_t root_methods[] = { /* Device interface */ KOBJMETHOD(device_shutdown, bus_generic_shutdown), KOBJMETHOD(device_suspend, bus_generic_suspend), - KOBJMETHOD(device_resume, bus_generic_resume), + KOBJMETHOD(device_resume, root_resume), /* Bus interface */ KOBJMETHOD(bus_print_child, root_print_child), |