hal: Branch 'master'

Martin Pitt martin at kemper.freedesktop.org
Tue May 12 04:31:53 PDT 2009


 hald/linux/addons/addon-acpi.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 4a41380945721ce563d3ebfa67272995ec7c7106
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Tue May 12 13:28:35 2009 +0200

    addon-acpi.c: Support acpid
    
    Do not try to open /proc/acpi/event if acpid exists, since that would
    stop acpid from being able to open it itself.
    
    acpid is a /proc/acpi/event multiplexer and event engine, see
    http://acpid.sourceforge.net/.
    
    Patch taken from Debian.

diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c
index fb4847d..8a1cac9 100644
--- a/hald/linux/addons/addon-acpi.c
+++ b/hald/linux/addons/addon-acpi.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/un.h>
 #include <unistd.h>
 
@@ -45,9 +46,14 @@ static FILE *
 acpi_get_event_fp_kernel (void)
 {
 	FILE *fp = NULL;
+	struct stat sbuf;
 
-	fp = fopen ("/proc/acpi/event", "r");
+	if (stat("/usr/sbin/acpid", &sbuf) == 0)  {
+		HAL_DEBUG (("acpid installed, not using the kernel acpi event interface"));
+		return NULL;
+	}
 
+	fp = fopen ("/proc/acpi/event", "r");
 	if (fp == NULL)
 		HAL_ERROR (("Cannot open /proc/acpi/event: %s", strerror (errno)));
 


More information about the hal-commit mailing list