Patch to make battstat work with 2.4.20 ACPI kernels



Hi guys!

Here in Spain manufacturers have started to sell laptops using a
complete SiS motherboard. With it, APM battery info doesn't work so the
only way to know the battery status is using ACPI. We have detected that
current battstat applet doesn't work with our ACPI, 2.4.20 kernels, so I
started to investigate why.

After playing a little with the applet, here goes the patch that makes
battstat works with ACPI in 2.4.20 kernels.

Is it ok to commit? I have tested it with ACPI and APM machines and it
seems to works nicely.

Cheers

-- 
Alvaro <acs barrapunto com>
Barrapunto
Index: acpi-linux.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/battstat/acpi-linux.c,v
retrieving revision 1.5
diff -u -r1.5 acpi-linux.c
--- acpi-linux.c	22 Nov 2002 22:11:23 -0000	1.5
+++ acpi-linux.c	18 Apr 2003 15:21:54 -0000
@@ -148,6 +148,7 @@
   char buf[BUFSIZ];
   GHashTable *hash;
   const char *ac_state_state, *charging_state;
+  const char *batt_state_state;
   char batt_info[60], batt_state[60], ac_state[60];
   DIR * procdir;
   struct dirent * procdirentry;
@@ -177,9 +178,11 @@
 
   if (acpi_ver < (gulong)20020208) {
     ac_state_state = "status";
+    batt_state_state = "status";
     charging_state = "state";
   } else {
     ac_state_state = "state";
+    batt_state_state = "state";
     charging_state = "charging state";
   }
 
@@ -201,7 +204,8 @@
        }
       strcpy(batt_state,"/proc/acpi/battery/");
       strcat(batt_state,procdirentry->d_name);
-      strcat(batt_state,"/state");
+      strcat(batt_state,"/");
+      strcat(batt_state,batt_state_state);
       hash = read_file (batt_state, buf, sizeof (buf));
       if (hash)
        {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]