Skip to content

Commit

Permalink
Add a global notify handler for logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
tqh committed Sep 5, 2014
1 parent 78d6bbf commit 5048bd4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ globalGPEHandler(UINT32 eventType, ACPI_HANDLE device, UINT32 eventNumber,
}


static void globalNotifyHandler(ACPI_HANDLE device, UINT32 value, void* context)
{
ACPI_BUFFER path;
char deviceName[256];
path.Length = sizeof(deviceName);
path.Pointer = deviceName;

ACPI_STATUS status = AcpiNsHandleToPathname(device, &path);
if (ACPI_FAILURE(status))
strcpy(deviceName, "(missing)");

dprintf("acpi: Notify event %d for %s\n", value, deviceName);
}


// #pragma mark - ACPI bus manager API


Expand Down Expand Up @@ -245,7 +260,11 @@ acpi_std_ops(int32 op,...)

checkAndLogFailure(
AcpiInstallGlobalEventHandler(globalGPEHandler, NULL),
"Failed to install global GPE handler.");
"Failed to install global GPE-handler.");

checkAndLogFailure(AcpiInstallNotifyHandler(ACPI_ROOT_OBJECT,
ACPI_ALL_NOTIFY, globalNotifyHandler, NULL),
"Failed to install global Notify-handler.");

checkAndLogFailure(AcpiEnableAllRuntimeGpes(),
"Failed to enable all runtime Gpes");
Expand Down

0 comments on commit 5048bd4

Please sign in to comment.