[haiku-commits] haiku: hrev46313 - in src/add-ons/kernel: drivers/power/acpi_ac drivers/power/acpi_lid bus_managers/acpi drivers/power/acpi_button

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 4 Nov 2013 18:13:49 +0100 (CET)

hrev46313 adds 5 changesets to branch 'master'
old head: 0e1c6462de668761511389dd1f358d3f0c458c65
new head: 6e157720e1ec9cd76db1316e86156b9f377546cb
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=6e15772+%5E0e1c646

----------------------------------------------------------------------------

b7c15bf: acpi: use AcpiGetObjectInfo() for get_device_hid().

d0a75d2: acpi: added driver for AC Adapter devices.
  
  * correctly report the AC status
  * notify handler not called

c9fb65f: acpi_button: improved traces

45c56fd: acpi_lid: correctly report lid status
  
  * notify handling not working (like acpi_ac).
  * deleted header
  * code cleanup

6e15772: only builds fwcontrol for x86

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

9 files changed, 395 insertions(+), 79 deletions(-)
build/jam/images/HaikuImage                      |   2 +-
.../kernel/bus_managers/acpi/BusManager.cpp      |  30 +-
src/add-ons/kernel/drivers/power/Jamfile         |   1 +
src/add-ons/kernel/drivers/power/acpi_ac/Jamfile |   5 +
.../kernel/drivers/power/acpi_ac/acpi_ac.cpp     | 300 +++++++++++++++++++
.../drivers/power/acpi_button/acpi_button.cpp    |  21 +-
.../kernel/drivers/power/acpi_lid/Jamfile        |  12 +-
.../kernel/drivers/power/acpi_lid/acpi_lid.cpp   |  90 ++++--
.../kernel/drivers/power/acpi_lid/acpi_lid.h     |  13 -

############################################################################

Commit:      b7c15bf02a57e54f0abe765380b66171a1c21965
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b7c15bf
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Fri Nov  1 15:49:34 2013 UTC

acpi: use AcpiGetObjectInfo() for get_device_hid().

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp 
b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
index 7d48b15..57fe4a0 100644
--- a/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
+++ b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
@@ -450,8 +450,7 @@ status_t
 get_device_hid(const char *path, char *hid, size_t bufferLength)
 {
        ACPI_HANDLE handle;
-       ACPI_OBJECT info;
-       ACPI_BUFFER infoBuffer;
+       ACPI_DEVICE_INFO *info;
 
        TRACE("get_device_hid: path %s, hid %s\n", path, hid);
        if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK)
@@ -460,29 +459,14 @@ get_device_hid(const char *path, char *hid, size_t 
bufferLength)
        if (bufferLength < ACPI_DEVICE_ID_LENGTH)
                return B_BUFFER_OVERFLOW;
 
-       infoBuffer.Pointer = &info;
-       infoBuffer.Length = sizeof(ACPI_OBJECT);
-       info.String.Pointer = hid;
-       info.String.Length = 9;
-       info.String.Type = ACPI_TYPE_STRING;
-
-       if (AcpiEvaluateObject(handle, "_HID", NULL, &infoBuffer) != AE_OK)
+       if (AcpiGetObjectInfo(handle, &info) != AE_OK)
                return B_BAD_TYPE;
 
-       if (info.Type == ACPI_TYPE_INTEGER) {
-               uint32 eisaId = AcpiUtDwordByteSwap(info.Integer.Value);
-
-               hid[0] = (char) ('@' + ((eisaId >> 26) & 0x1f));
-               hid[1] = (char) ('@' + ((eisaId >> 21) & 0x1f));
-               hid[2] = (char) ('@' + ((eisaId >> 16) & 0x1f));
-               hid[3] = AcpiUtHexToAsciiChar((ACPI_INTEGER)eisaId, 12);
-               hid[4] = AcpiUtHexToAsciiChar((ACPI_INTEGER)eisaId, 8);
-               hid[5] = AcpiUtHexToAsciiChar((ACPI_INTEGER)eisaId, 4);
-               hid[6] = AcpiUtHexToAsciiChar((ACPI_INTEGER)eisaId, 0);
-               hid[7] = 0;
-       }
-
-       hid[ACPI_DEVICE_ID_LENGTH] = '\0';
+       if ((info->Valid & ACPI_VALID_HID) != 0)
+               strlcpy(hid, info->HardwareId.String, bufferLength);
+       else
+               hid[0] = '\0';
+       AcpiOsFree(info);
        return B_OK;
 }
 

############################################################################

Commit:      d0a75d2c3a167a4a91d1c1751eff576e49c19d6c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d0a75d2
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Fri Nov  1 19:27:22 2013 UTC

acpi: added driver for AC Adapter devices.

* correctly report the AC status
* notify handler not called

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/power/Jamfile 
b/src/add-ons/kernel/drivers/power/Jamfile
index 45feced..01c7932 100644
--- a/src/add-ons/kernel/drivers/power/Jamfile
+++ b/src/add-ons/kernel/drivers/power/Jamfile
@@ -1,5 +1,6 @@
 SubDir HAIKU_TOP src add-ons kernel drivers power ;
 
+SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_ac ;
 SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_battery ;
 SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_button ;
 SubInclude HAIKU_TOP src add-ons kernel drivers power acpi_lid ;
diff --git a/src/add-ons/kernel/drivers/power/acpi_ac/Jamfile 
b/src/add-ons/kernel/drivers/power/acpi_ac/Jamfile
new file mode 100644
index 0000000..9d36385
--- /dev/null
+++ b/src/add-ons/kernel/drivers/power/acpi_ac/Jamfile
@@ -0,0 +1,5 @@
+SubDir HAIKU_TOP src add-ons kernel drivers power acpi_ac ;
+
+KernelAddon acpi_ac :
+       acpi_ac.cpp
+       ;
diff --git a/src/add-ons/kernel/drivers/power/acpi_ac/acpi_ac.cpp 
b/src/add-ons/kernel/drivers/power/acpi_ac/acpi_ac.cpp
new file mode 100644
index 0000000..009aba1
--- /dev/null
+++ b/src/add-ons/kernel/drivers/power/acpi_ac/acpi_ac.cpp
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2013, Jérôme Duval, korli@xxxxxxxxxxxxxxxx.
+ *
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <ACPI.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#define ACPI_AC_MODULE_NAME "drivers/power/acpi_ac/driver_v1"
+
+#define ACPI_AC_DEVICE_MODULE_NAME "drivers/power/acpi_ac/device_v1"
+
+/* Base Namespace devices are published to */
+#define ACPI_AC_BASENAME "power/acpi_ac/%d"
+
+// name of pnp generator of path ids
+#define ACPI_AC_PATHID_GENERATOR "acpi_ac/path_id"
+
+#define TRACE_AC
+#ifdef TRACE_AC
+#      define TRACE(x...) dprintf("acpi_ac: "x)
+#else
+#      define TRACE(x...)
+#endif
+#define ERROR(x...)    dprintf("acpi_ac: "x)
+
+static device_manager_info *sDeviceManager;
+
+
+typedef struct acpi_ns_device_info {
+       device_node *node;
+       acpi_device_module_info *acpi;
+       acpi_device acpi_cookie;
+       uint8 last_status;
+} acpi_ac_device_info;
+
+
+static void
+acpi_ac_notify_handler(acpi_handle device, uint32 value, void *context)
+{
+       if (value == 0x80) {
+               dprintf("acpi_ac: status changed\n");
+       } else {
+               dprintf("acpi_ac: unknown notification\n");
+       }
+
+}
+
+
+//     #pragma mark - device module API
+
+
+static status_t
+acpi_ac_init_device(void *_cookie, void **cookie)
+{
+       device_node *node = (device_node *)_cookie;
+       acpi_ac_device_info *device;
+       device_node *parent;
+       status_t status;
+
+       device = (acpi_ac_device_info *)calloc(1, sizeof(*device));
+       if (device == NULL)
+               return B_NO_MEMORY;
+
+       device->node = node;
+
+       parent = sDeviceManager->get_parent_node(node);
+       sDeviceManager->get_driver(parent, (driver_module_info **)&device->acpi,
+               (void **)&device->acpi_cookie);
+       sDeviceManager->put_node(parent);
+
+       status = device->acpi->install_notify_handler(device->acpi_cookie,
+               ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler, device);
+       if (status != B_OK) {
+               ERROR("can't install notify handler\n");
+       }
+
+       device->last_status = 0;
+       acpi_data buf;
+       buf.pointer = NULL;
+       buf.length = ACPI_ALLOCATE_BUFFER;
+       if (device->acpi->evaluate_method(device->acpi_cookie, "_PSR", NULL,
+                       &buf) != B_OK
+               || buf.pointer == NULL
+               || ((acpi_object_type*)buf.pointer)->object_type != 
ACPI_TYPE_INTEGER) {
+               ERROR("couldn't get status\n");
+       } else {
+               acpi_object_type* object = (acpi_object_type*)buf.pointer;
+               device->last_status = object->integer.integer;
+               free(buf.pointer);
+               TRACE("status %d\n", device->last_status);
+       }
+
+       *cookie = device;
+       return B_OK;
+}
+
+
+static void
+acpi_ac_uninit_device(void *_cookie)
+{
+       acpi_ac_device_info *device = (acpi_ac_device_info *)_cookie;
+
+       device->acpi->remove_notify_handler(device->acpi_cookie,
+               ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler);
+
+       free(device);
+}
+
+
+static status_t
+acpi_ac_open(void *_cookie, const char *path, int flags, void** cookie)
+{
+       acpi_ac_device_info *device = (acpi_ac_device_info *)_cookie;
+       *cookie = device;
+       return B_OK;
+}
+
+
+static status_t
+acpi_ac_read(void* _cookie, off_t position, void *buf, size_t* num_bytes)
+{
+       acpi_ac_device_info* device = (acpi_ac_device_info*)_cookie;
+       if (*num_bytes < 1)
+               return B_IO_ERROR;
+
+       *((uint8 *)(buf)) = device->last_status;
+
+       *num_bytes = 1;
+       return B_OK;
+}
+
+
+static status_t
+acpi_ac_write(void* cookie, off_t position, const void* buffer, size_t* 
num_bytes)
+{
+       return B_ERROR;
+}
+
+
+static status_t
+acpi_ac_control(void* _cookie, uint32 op, void* arg, size_t len)
+{
+       return B_ERROR;
+}
+
+
+static status_t
+acpi_ac_close (void* cookie)
+{
+       return B_OK;
+}
+
+
+static status_t
+acpi_ac_free (void* cookie)
+{
+       return B_OK;
+}
+
+
+//     #pragma mark - driver module API
+
+
+static float
+acpi_ac_support(device_node *parent)
+{
+       const char *bus;
+       uint32 device_type;
+       const char *hid;
+
+       // make sure parent is really the ACPI bus manager
+       if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false))
+               return -1;
+
+       if (strcmp(bus, "acpi"))
+               return 0.0;
+
+       // check whether it's really a device
+       if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM,
+                       &device_type, false) != B_OK
+               || device_type != ACPI_TYPE_DEVICE) {
+               return 0.0;
+       }
+
+       // check whether it's an ac device
+       if (sDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid,
+               false) != B_OK || strcmp(hid, "ACPI0003")) {
+               return 0.0;
+       }
+
+       dprintf("acpi_ac_support ac device found\n");
+
+       return 0.6;
+}
+
+
+static status_t
+acpi_ac_register_device(device_node *node)
+{
+       device_attr attrs[] = {
+               { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, { string: "ACPI AC" }},
+               { NULL }
+       };
+
+       return sDeviceManager->register_node(node, ACPI_AC_MODULE_NAME, attrs,
+               NULL, NULL);
+}
+
+
+static status_t
+acpi_ac_init_driver(device_node *node, void **_driverCookie)
+{
+       *_driverCookie = node;
+       return B_OK;
+}
+
+
+static void
+acpi_ac_uninit_driver(void *driverCookie)
+{
+}
+
+
+static status_t
+acpi_ac_register_child_devices(void *_cookie)
+{
+       device_node *node = (device_node *)_cookie;
+       int path_id;
+       char name[128];
+
+       path_id = sDeviceManager->create_id(ACPI_AC_PATHID_GENERATOR);
+       if (path_id < 0) {
+               dprintf("acpi_ac_register_child_devices: couldn't create a 
path_id\n");
+               return B_ERROR;
+       }
+
+       snprintf(name, sizeof(name), ACPI_AC_BASENAME, path_id);
+
+       return sDeviceManager->publish_device(node, name, 
ACPI_AC_DEVICE_MODULE_NAME);
+}
+
+
+module_dependency module_dependencies[] = {
+       { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&sDeviceManager },
+       {}
+};
+
+
+driver_module_info acpi_ac_driver_module = {
+       {
+               ACPI_AC_MODULE_NAME,
+               0,
+               NULL
+       },
+
+       acpi_ac_support,
+       acpi_ac_register_device,
+       acpi_ac_init_driver,
+       acpi_ac_uninit_driver,
+       acpi_ac_register_child_devices,
+       NULL,   // rescan
+       NULL,   // removed
+};
+
+
+struct device_module_info acpi_ac_device_module = {
+       {
+               ACPI_AC_DEVICE_MODULE_NAME,
+               0,
+               NULL
+       },
+
+       acpi_ac_init_device,
+       acpi_ac_uninit_device,
+       NULL,
+
+       acpi_ac_open,
+       acpi_ac_close,
+       acpi_ac_free,
+       acpi_ac_read,
+       acpi_ac_write,
+       NULL,
+       acpi_ac_control,
+
+       NULL,
+       NULL
+};
+
+module_info *modules[] = {
+       (module_info *)&acpi_ac_driver_module,
+       (module_info *)&acpi_ac_device_module,
+       NULL
+};

############################################################################

Commit:      c9fb65f96183037ffd169d154a636dfc8f6c3cc8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c9fb65f
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Fri Nov  1 19:29:55 2013 UTC

acpi_button: improved traces

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/power/acpi_button/acpi_button.cpp 
b/src/add-ons/kernel/drivers/power/acpi_button/acpi_button.cpp
index 285a3e4..c0cf44a 100644
--- a/src/add-ons/kernel/drivers/power/acpi_button/acpi_button.cpp
+++ b/src/add-ons/kernel/drivers/power/acpi_button/acpi_button.cpp
@@ -27,6 +27,7 @@
 #else
 #      define TRACE(x...)
 #endif
+#define ERROR(x...)    dprintf("acpi_button: "x)
 
 static device_manager_info *sDeviceManager;
 static struct acpi_module_info *sAcpi;
@@ -47,12 +48,12 @@ acpi_button_notify_handler(acpi_handle _device, uint32 
value, void *context)
 {
        acpi_button_device_info *device = (acpi_button_device_info *)context;
        if (value == ACPI_NOTIFY_BUTTON_SLEEP) {
-               TRACE("acpi_button: sleep\n");
+               TRACE("sleep\n");
                device->last_status = 1;
        } else if (value == ACPI_NOTIFY_BUTTON_WAKEUP) {
-               TRACE("acpi_button: wakeup\n");
+               TRACE("wakeup\n");
        } else {
-               dprintf("acpi_button: unknown notification\n");
+               ERROR("unknown notification\n");
        }
 
 }
@@ -62,7 +63,7 @@ static uint32
 acpi_button_fixed_handler(void *context)
 {
        acpi_button_device_info *device = (acpi_button_device_info *)context;
-       TRACE("acpi_button: sleep\n");
+       TRACE("sleep\n");
        device->last_status = 1;
        return B_OK;
 }
@@ -108,11 +109,15 @@ acpi_button_init_device(void *_cookie, void **cookie)
 
        if (device->fixed) {
                sAcpi->reset_fixed_event(device->type);
-               sAcpi->install_fixed_event_handler(device->type,
-                       acpi_button_fixed_handler, device);
+               if (sAcpi->install_fixed_event_handler(device->type,
+                       acpi_button_fixed_handler, device) != B_OK) {
+                       ERROR("can't install notify handler\n");
+               }
        } else {
-               device->acpi->install_notify_handler(device->acpi_cookie,
-                       ACPI_DEVICE_NOTIFY, acpi_button_notify_handler, device);
+               if (device->acpi->install_notify_handler(device->acpi_cookie,
+                       ACPI_DEVICE_NOTIFY, acpi_button_notify_handler, device) 
!= B_OK) {
+                       ERROR("can't install notify handler\n");
+               }
        }
 
 

############################################################################

Commit:      45c56fdb6b6ac5a882d597d3337e860cd726a11a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=45c56fd
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Fri Nov  1 19:31:03 2013 UTC

acpi_lid: correctly report lid status

* notify handling not working (like acpi_ac).
* deleted header
* code cleanup

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile 
b/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile
index 48de919..e104f9a 100644
--- a/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile
+++ b/src/add-ons/kernel/drivers/power/acpi_lid/Jamfile
@@ -1,15 +1,5 @@
 SubDir HAIKU_TOP src add-ons kernel drivers power acpi_lid ;
 
-SetSubDirSupportedPlatformsBeOSCompatible ;
-
-if $(TARGET_PLATFORM) != haiku {
-       # Needed for <ACPI.h>. Unfortunately we also get the other headers 
there,
-       # that we don't really want.
-       UsePublicHeaders drivers ;
-}
-
 KernelAddon acpi_lid :
-       acpi_lid.c
+       acpi_lid.cpp
        ;
-
-Depends acpi_lid : acpi ;
diff --git a/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.cpp 
b/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.cpp
index d2bfaf1..eb63be7 100644
--- a/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.cpp
+++ b/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.cpp
@@ -1,19 +1,16 @@
 /*
- * Copyright 2008, Haiku, Inc. All Rights Reserved.
+ * Copyright 2008-2013, Jérôme Duval, korli@xxxxxxxxxxxxxxxx.
  *
  * Distributed under the terms of the MIT License.
  */
 
-#include <KernelExport.h>
-#include <Drivers.h>
-#include <Errors.h>
-#include <string.h>
+
+#include <ACPI.h>
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-#include <ACPI.h>
-#include "acpi_lid.h"
 
 #define ACPI_LID_MODULE_NAME "drivers/power/acpi_lid/driver_v1"
 
@@ -25,15 +22,37 @@
 // name of pnp generator of path ids
 #define ACPI_LID_PATHID_GENERATOR "acpi_lid/path_id"
 
+#define TRACE_LID
+#ifdef TRACE_LID
+#      define TRACE(x...) dprintf("acpi_lid: "x)
+#else
+#      define TRACE(x...)
+#endif
+#define ERROR(x...)    dprintf("acpi_lid: "x)
+
 static device_manager_info *sDeviceManager;
 
+
 typedef struct acpi_ns_device_info {
        device_node *node;
        acpi_device_module_info *acpi;
        acpi_device acpi_cookie;
+       uint8 last_status;
 } acpi_lid_device_info;
 
 
+static void
+acpi_lid_notify_handler(acpi_handle device, uint32 value, void *context)
+{
+       if (value == 0x80) {
+               dprintf("acpi_lid: status changed\n");
+       } else {
+               dprintf("acpi_lid: unknown notification\n");
+       }
+
+}
+
+
 //     #pragma mark - device module API
 
 
@@ -43,7 +62,8 @@ acpi_lid_init_device(void *_cookie, void **cookie)
        device_node *node = (device_node *)_cookie;
        acpi_lid_device_info *device;
        device_node *parent;
-       
+       status_t status;
+
        device = (acpi_lid_device_info *)calloc(1, sizeof(*device));
        if (device == NULL)
                return B_NO_MEMORY;
@@ -55,6 +75,28 @@ acpi_lid_init_device(void *_cookie, void **cookie)
                (void **)&device->acpi_cookie);
        sDeviceManager->put_node(parent);
 
+       status = device->acpi->install_notify_handler(device->acpi_cookie, 
ACPI_DEVICE_NOTIFY,
+               acpi_lid_notify_handler, device);
+       if (status != B_OK) {
+               ERROR("can't install notify handler\n");
+       }
+
+       device->last_status = 0;
+       acpi_data buf;
+       buf.pointer = NULL;
+       buf.length = ACPI_ALLOCATE_BUFFER;
+       if (device->acpi->evaluate_method(device->acpi_cookie, "_LID", NULL,
+                       &buf) != B_OK
+               || buf.pointer == NULL
+               || ((acpi_object_type*)buf.pointer)->object_type != 
ACPI_TYPE_INTEGER) {
+               ERROR("couldn't get status\n");
+       } else {
+               acpi_object_type* object = (acpi_object_type*)buf.pointer;
+               device->last_status = object->integer.integer;
+               free(buf.pointer);
+               TRACE("status %d\n", device->last_status);
+       }
+
        *cookie = device;
        return B_OK;
 }
@@ -64,6 +106,10 @@ static void
 acpi_lid_uninit_device(void *_cookie)
 {
        acpi_lid_device_info *device = (acpi_lid_device_info *)_cookie;
+
+       device->acpi->remove_notify_handler(device->acpi_cookie, 
ACPI_DEVICE_NOTIFY,
+               acpi_lid_notify_handler);
+
        free(device);
 }
 
@@ -94,8 +140,6 @@ acpi_lid_write(void* cookie, off_t position, const void* 
buffer, size_t* num_byt
 static status_t
 acpi_lid_control(void* _cookie, uint32 op, void* arg, size_t len)
 {
-       acpi_lid_device_info* device = (acpi_lid_device_info*)_cookie;
-       
        return B_ERROR;
 }
 
@@ -109,7 +153,7 @@ acpi_lid_close (void* cookie)
 
 static status_t
 acpi_lid_free (void* cookie)
-{      
+{
        return B_OK;
 }
 
@@ -124,27 +168,28 @@ acpi_lid_support(device_node *parent)
        uint32 device_type;
        const char *hid;
 
-       dprintf("acpi_lid_support\n");
-
        // make sure parent is really the ACPI bus manager
        if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false))
                return -1;
-       
+
        if (strcmp(bus, "acpi"))
                return 0.0;
 
        // check whether it's really a device
-       if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, 
&device_type, false) != B_OK
+       if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM,
+                       &device_type, false) != B_OK
                || device_type != ACPI_TYPE_DEVICE) {
                return 0.0;
        }
 
        // check whether it's a lid device
-       if (sDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid, 
false) != B_OK
-               || strcmp(hid, "PNP0C0D")) {
+       if (sDeviceManager->get_attr_string(parent, ACPI_DEVICE_HID_ITEM, &hid,
+               false) != B_OK || strcmp(hid, "PNP0C0D")) {
                return 0.0;
        }
 
+       dprintf("acpi_lid_support lid device found\n");
+
        return 0.6;
 }
 
@@ -157,7 +202,8 @@ acpi_lid_register_device(device_node *node)
                { NULL }
        };
 
-       return sDeviceManager->register_node(node, ACPI_LID_MODULE_NAME, attrs, 
NULL, NULL);
+       return sDeviceManager->register_node(node, ACPI_LID_MODULE_NAME, attrs,
+               NULL, NULL);
 }
 
 
@@ -178,20 +224,18 @@ acpi_lid_uninit_driver(void *driverCookie)
 static status_t
 acpi_lid_register_child_devices(void *_cookie)
 {
-       device_node *node = _cookie;
+       device_node *node = (device_node *)_cookie;
        int path_id;
        char name[128];
 
-       dprintf("acpi_lid_register_child_devices\n");
-               
        path_id = sDeviceManager->create_id(ACPI_LID_PATHID_GENERATOR);
        if (path_id < 0) {
                dprintf("acpi_lid_register_child_devices: couldn't create a 
path_id\n");
                return B_ERROR;
        }
-       
+
        snprintf(name, sizeof(name), ACPI_LID_BASENAME, path_id);
-               
+
        return sDeviceManager->publish_device(node, name, 
ACPI_LID_DEVICE_MODULE_NAME);
 }
 
diff --git a/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h 
b/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h
deleted file mode 100644
index c6f4fb8..0000000
--- a/src/add-ons/kernel/drivers/power/acpi_lid/acpi_lid.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2008, Haiku, Inc. All Rights Reserved.
- *
- * Distributed under the terms of the MIT License.
- */
-#ifndef _ACPI_LID_H
-#define _ACPI_LID_H
-
-#include <KernelExport.h>
-#include <ACPI.h>
-
-
-#endif /* _ACPI_LID_H */

############################################################################

Revision:    hrev46313
Commit:      6e157720e1ec9cd76db1316e86156b9f377546cb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6e15772
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Sat Nov  2 13:40:33 2013 UTC

only builds fwcontrol for x86

----------------------------------------------------------------------------

diff --git a/build/jam/images/HaikuImage b/build/jam/images/HaikuImage
index 6931135..fee51f8 100644
--- a/build/jam/images/HaikuImage
+++ b/build/jam/images/HaikuImage
@@ -13,7 +13,7 @@ SYSTEM_BIN = [ FFilterByBuildFeatures
        diskimage draggers driveinfo dstcheck du dumpcatalog
        echo eject env error expand expr
        factor false fdinfo ffm filepanel find finddir FirstBootPrompt fmt fold
-       fortune frcode ftp ftpd funzip fwcontrol
+       fortune frcode ftp ftpd funzip fwcontrol@x86
        gawk gdb@x86 getlimits groupadd groupdel groupmod groups gzip gzexe
        hd head hey hostname
        id ident ifconfig <bin>install installsound iroster isvolume


Other related posts:

  • » [haiku-commits] haiku: hrev46313 - in src/add-ons/kernel: drivers/power/acpi_ac drivers/power/acpi_lid bus_managers/acpi drivers/power/acpi_button - korli