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:
@@ -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_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);
|
status_t (*get_device_hid) (const char *path, char *hid);
|
||||||
uint32 (*get_object_type) (const char *path);
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
status_t get_device_hid (const char *path, char *hid);
|
||||||
uint32 get_object_type (const char *path);
|
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 = {
|
struct acpi_module_info acpi_module = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -177,3 +179,14 @@ uint32 get_object_type (const char *path) {
|
|||||||
AcpiGetType(handle,&type);
|
AcpiGetType(handle,&type);
|
||||||
return 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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user