diff options
author | njl <njl@FreeBSD.org> | 2003-10-25 05:03:25 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-10-25 05:03:25 +0000 |
commit | bcfcc4ec03c6e17a313c90ea3e6c8365ac38a56f (patch) | |
tree | f99a0a9cead000dd7aa9b256d999d0e451d0c239 /sys/dev/acpica/acpi.c | |
parent | cdc83babef20f1fd97d3bbab52fb817c3f07a8bf (diff) | |
download | FreeBSD-src-bcfcc4ec03c6e17a313c90ea3e6c8365ac38a56f.zip FreeBSD-src-bcfcc4ec03c6e17a313c90ea3e6c8365ac38a56f.tar.gz |
Add devctl(4) notify support to ACPI. Various subsystems now notify
userland whenever events occur. See the example in devd.conf below
to see how to use it.
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r-- | sys/dev/acpica/acpi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 43dca2a..33cb20c 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -51,6 +51,7 @@ #include "acpi.h" #include <dev/acpica/acpivar.h> #include <dev/acpica/acpiio.h> +#include <contrib/dev/acpica/acnamesp.h> MALLOC_DEFINE(M_ACPIDEV, "acpidev", "ACPI devices"); @@ -2054,6 +2055,27 @@ acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS) return (error); } +/* Inform devctl(4) when we receive a Notify. */ +void +acpi_UserNotify(const char *subsystem, ACPI_HANDLE h, uint8_t notify) +{ + char notify_buf[16]; + ACPI_BUFFER handle_buf; + ACPI_STATUS status; + + if (subsystem == NULL) + return; + + handle_buf.Pointer = NULL; + handle_buf.Length = ACPI_ALLOCATE_BUFFER; + status = AcpiNsHandleToPathname(h, &handle_buf); + if (ACPI_FAILURE(status)) + return; + snprintf(notify_buf, sizeof(notify_buf), "notify=0x%02x", notify); + devctl_notify("ACPI", subsystem, handle_buf.Pointer, notify_buf); + AcpiOsFree(handle_buf.Pointer); +} + #ifdef ACPI_DEBUG /* * Support for parsing debug options from the kernel environment. |