summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2009-05-12 13:28:35 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2009-05-12 13:28:35 +0200
commit4a41380945721ce563d3ebfa67272995ec7c7106 (patch)
tree903be54d496a5ce235fe84031e6456f61ea2224f
parente872e906789ec6efa2f61a56e8557653d1fa03e1 (diff)
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.
-rw-r--r--hald/linux/addons/addon-acpi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c
index fb4847d4..8a1cac97 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)));