hal/hald/linux2/addons addon-acpi.c,1.8,1.9
Kay Sievers
kay at freedesktop.org
Sat Aug 6 06:15:44 PDT 2005
Update of /cvs/hal/hal/hald/linux2/addons
In directory gabe:/tmp/cvs-serv24168/hald/linux2/addons
Modified Files:
addon-acpi.c
Log Message:
2005-08-06 Kay Sievers <kay.sievers at vrfy.org>
* configure.in:
* hald/linux2/addons/addon-acpi.c: (main):
Make the possible ACPI event sources configurable, cause binding
the exclusive kernel socket instead of the proposed acpid socket
may cause trouble.
Index: addon-acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-acpi.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- addon-acpi.c 29 Jul 2005 20:32:57 -0000 1.8
+++ addon-acpi.c 6 Aug 2005 13:15:42 -0000 1.9
@@ -109,26 +109,36 @@
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;
More information about the hal-commit
mailing list