summaryrefslogtreecommitdiff
blob: 6ed6f3976bb825b699a19e46a07a710f84d2742b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- battstat_applet-2.0.13-orig/src/acpi-linux.c	Sun Nov  4 23:41:22
2001
+++ battstat_applet-2.0.13/src/acpi-linux.c	Tue May  7 12:28:31 2002
@@ -49,7 +49,7 @@
       if ((c = strchr(tmp, ':'))) // Is a colon separated line
         {
           *c = 0;
-          if (strcmp(tmp, field) == 0) // It is the right line
+          if (strcasecmp(tmp, field) == 0) // It is the right line
             {
               c++; // Find the beginning of the data
               if (*c)
@@ -106,11 +106,11 @@
   low_capacity = 0;
   critical_capacity = 0;
 
-  if ((f = fopen("/proc/acpi/battery/1/info", "r")))
+  if ((f = fopen("/proc/acpi/battery/BAT1/info", "r")))
     {
-      max_capacity = al_get_field_int(f, "Design Capacity");
-      low_capacity = al_get_field_int(f, "Design Capacity Warning");
-      critical_capacity = al_get_field_int(f, "Design Capacity Low");
+      max_capacity = al_get_field_int(f, "design capacity");
+      low_capacity = al_get_field_int(f, "design capacity warning");
+      critical_capacity = al_get_field_int(f, "design capacity low");
       
       fclose(f);
     }
@@ -121,27 +121,27 @@
   charging = FALSE;
   remain = 0;
 
-  if ((f = fopen("/proc/acpi/battery/1/status", "r")))
+  if ((f = fopen("/proc/acpi/battery/BAT1/state", "r")))
     {
       gchar *s;
       gchar tmp[256];
 
-      if ((s = al_get_field(f, "State", tmp, sizeof(tmp))))
+      if ((s = al_get_field(f, "charging state", tmp, sizeof(tmp))))
         charging = strcmp(s, "charging") == 0;
       
-      remain = al_get_field_int(f, "Remaining Capacity");
+      remain = al_get_field_int(f, "remaining capacity");
 
       fclose(f);
     }
   
   ac_online = FALSE;
   
-  if ((f = fopen("/proc/acpi/ac_adapter/0/status", "r")))
+  if ((f = fopen("/proc/acpi/ac_adapter/ACAD/state", "r")))
     {
       gchar *s;
       gchar tmp[256];      
 
-      if ((s = al_get_field(f, "Status", tmp, sizeof(tmp))))
+      if ((s = al_get_field(f, "state", tmp, sizeof(tmp))))
         ac_online = strcmp(s, "on-line") == 0;
 
       fclose(f);