[PATCH] command line options for hald-addon-acpi
Kay Sievers
kay.sievers at vrfy.org
Thu Aug 4 09:33:26 PDT 2005
On Tue, Aug 02, 2005 at 01:35:30PM -0400, David Zeuthen wrote:
> On Tue, 2005-08-02 at 18:52 +0200, Danny Kukawka wrote:
> > No. If I change the entry in 10-power-mgmt-policy.fdi and add there the needed
> > command line options, hald-addon-acpi is launched by hald with this
> > commandline options (tested ;-) ).
>
> Hmm, if you really want this (though I'm arguing you shouldn't want it
> =) I'd accept a patch to provide a compile-time options for this. I
> don't really think run-time options are warranted here, do you?
Here are configure options.
Note:
Reading a second time through this thread, I agree that blocking the
kernel event source with HAL, while HAL is not the general ACPI event
interface is just the wrong behavior. So here we can disable the direct
use of the kernel interface and use the usual acpid source only.
Kay
-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /cvs/hal/hal/configure.in,v
retrieving revision 1.95
diff -u -p -r1.95 configure.in
--- configure.in 28 Jul 2005 00:55:09 -0000 1.95
+++ configure.in 4 Aug 2005 16:19:06 -0000
@@ -121,6 +121,21 @@ fi
AC_SUBST(PCMCIA_STAB_FILE)
AC_DEFINE_UNQUOTED(PCMCIA_STAB_FILE,"$PCMCIA_STAB_FILE", [PCMCIA socket table file])
+# ACPI event source
+AC_ARG_ENABLE(acpi-acpid, [ --disable-acpi-acpid Use ACPI daemon event source],acpi_acpid=no,acpi_acpid=yes)
+if test "x$acpi_acpid" == "xyes" ; then
+ AC_DEFINE(ACPI_ACPID,1,[Common event source of ACPI events])
+fi
+AC_SUBST(ACPI_ACPID)
+AM_CONDITIONAL(ACPI_ACPID, test x$acpi_acpid != xyes)
+
+AC_ARG_ENABLE(acpi-proc, [ --disable-acpi-proc Use ACPI kernel-interface directly(the kernel supports only one listener)],acpi_proc=no,acpi_proc=yes)
+if test "x$acpi_proc" == "xyes" ; then
+ AC_DEFINE(ACPI_PROC,1,[Direct kernel connection for ACPI events, the kernel interface is exclusiv to one user only])
+fi
+AC_SUBST(ACPI_PROC)
+AM_CONDITIONAL(ACPI_PROC, test x$acpi_proc == xyes)
+
#### gcc warning flags
if test "x$GCC" = "xyes"; then
Index: hald/linux2/addons/addon-acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-acpi.c,v
retrieving revision 1.8
diff -u -p -r1.8 addon-acpi.c
--- hald/linux2/addons/addon-acpi.c 29 Jul 2005 20:32:57 -0000 1.8
+++ hald/linux2/addons/addon-acpi.c 4 Aug 2005 16:19:06 -0000
@@ -109,26 +109,36 @@ main (int argc, char *argv[])
if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
goto out;
- /* TODO: get mountpoint of proc from... /proc/mounts.. :-) */
- fd = open ("/proc/acpi/event", O_RDONLY);
+#ifdef ACPI_ACPID
+ /* receive event from acpi daemon */
+ fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
- dbg ("Cannot open /proc/acpi/event: %s - trying /var/run/acpid.socket", strerror (errno));
-
- /* TODO: make /var/run/acpid.socket a configure option */
+ dbg ("Cannot create socket");
+ goto out;
+ }
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ snprintf (addr.sun_path, sizeof (addr.sun_path), "%s", "/var/run/acpid.socket");
+ if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
+ close (fd);
+ dbg ("Cannot connect to acpid socket");
+ fd = -1;
+ }
+#endif
- fd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
- return fd;
- }
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- snprintf (addr.sun_path, sizeof (addr.sun_path), "%s", "/var/run/acpid.socket");
- if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
- dbg ("Cannot open /var/run/acpid.socket - bailing out");
- goto out;
- }
+#ifdef ACPI_PROC
+ /* connect directly to the kernel */
+ if (fd < 0) {
+ fd = open ("/proc/acpi/event", O_RDONLY);
+ dbg ("Cannot open /proc/acpi/event: %s", strerror (errno));
}
-
+#endif
+
+ if (fd < 0) {
+ dbg ("Cannot connect to acpi event source - bailing out");
+ goto out;
+ }
+
/* main loop */
while (1) {
char *event;
-------------- next part --------------
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list