From 92ba8215d2db1683c59bae9c28f4f7e28fc54e35 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Thu, 3 Mar 2005 00:01:35 +0000 Subject: [PATCH] Added basic (i.e. argumentless) control method execution. Now we can read fan speeds, cpu temperatures, laptop lid states, and all sorts of other glorious things. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11545 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/ACPI.h | 4 ++++ src/add-ons/kernel/bus_managers/acpi/acpi_busman.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/headers/os/drivers/ACPI.h b/headers/os/drivers/ACPI.h index 3c733f9117..98f6bbce8b 100644 --- a/headers/os/drivers/ACPI.h +++ b/headers/os/drivers/ACPI.h @@ -32,6 +32,10 @@ struct acpi_module_info { status_t (*get_next_entry) (uint32 object_type, const char *base, char *result, size_t len, void **counter); status_t (*get_device_hid) (const char *path, char *hid); uint32 (*get_object_type) (const char *path); + + /* Control method execution and data acquisition */ + + status_t (*evaluate_object) (const char *object, void *return_value, size_t buf_len); }; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index fa97205813..08b884e4fc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -21,6 +21,8 @@ status_t get_next_entry (uint32 object_type, const char *base, char *result, siz status_t get_device_hid (const char *path, char *hid); uint32 get_object_type (const char *path); +status_t evaluate_object (const char *object, void *return_value, size_t buf_len); + struct acpi_module_info acpi_module = { { { @@ -177,3 +179,14 @@ uint32 get_object_type (const char *path) { AcpiGetType(handle,&type); return type; } + +status_t evaluate_object (const char *object, void *return_value, size_t buf_len) { + ACPI_BUFFER buffer; + ACPI_STATUS status; + + buffer.Pointer = return_value; + buffer.Length = buf_len; + + status = AcpiEvaluateObject(NULL,object,NULL,&buffer); + return (status == AE_OK) ? B_OK : B_ERROR; +}