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
This commit is contained in:
Nathan Whitehorn 2005-03-03 00:01:35 +00:00
parent a57bb4edc8
commit 92ba8215d2
2 changed files with 17 additions and 0 deletions

View File

@ -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);
};

View File

@ -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;
}