Package: wmacpi
Version: 2.1-6

With the latest 2.6 Linux kernels, when the deprecated CONFIG_ACPI_PROCFS is
not selected, wmacpi fails to start because /proc/acpi/info doesn't exist.

Instaed, wmacpi should read /sys/module/acpi/parameters/acpica_version.
I am attaching a patch to this mail that fixes this problem while keeping
backward compatibility with systems where /proc/acpi/info exists.

This bug report is also sent to the upstream maintainer. 

---
 libacpi.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/libacpi.c b/libacpi.c
index 6ea74d6..b4e9dce 100644
--- a/libacpi.c
+++ b/libacpi.c
@@ -139,15 +139,20 @@ int power_init(global_t *globals)
     char buf[4096];
     int acpi_ver = 0;
     int retval;
-
-    if (!(acpi = fopen("/proc/acpi/info", "r"))) {
-       pfatal("This system does not support ACPI\n");
-       return 1;
+    unsigned int version_offset = 0;
+
+    if (!(acpi = fopen("/sys/module/acpi/parameters/acpica_version", "r"))) {
+           if (!(acpi = fopen("/proc/acpi/info", "r"))) {
+                   pfatal("This system does not support ACPI\n");
+                   return 1;
+           } else {
+                   version_offset = 25;
+           }
     }
 
     /* okay, now see if we got the right version */
     fread(buf, 4096, 1, acpi);
-    acpi_ver = strtol(buf + 25, NULL, 10);
+    acpi_ver = strtol(buf + version_offset, NULL, 10);
     pinfo("ACPI version detected: %d\n", acpi_ver);
     if (acpi_ver < 20020214) {
        pfatal("This version requires ACPI subsystem version 20020214\n");
@@ -169,7 +174,8 @@ int power_reinit(global_t *globals)
     FILE *acpi;
     int retval;
 
-    if (!(acpi = fopen("/proc/acpi/info", "r"))) {
+    if (!(acpi = fopen("/proc/acpi/info", "r")) &&
+       !(acpi = fopen("/sys/module/acpi/parameters/acpica_version", "r"))) {
        pfatal("Could not reopen ACPI info file - does this system support 
ACPI?\n");
        return 1;
     }
-- 
1.4.4.4



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to