[Pkg-xfce-commits] r356 -
goodies/xfce4-battery-plugin/debian/patches
Jani Monoses
jani-guest at costa.debian.org
Sat Dec 17 21:14:54 UTC 2005
Author: jani-guest
Date: 2005-12-17 21:14:54 +0000 (Sat, 17 Dec 2005)
New Revision: 356
Modified:
goodies/xfce4-battery-plugin/debian/patches/00_proc_ac_adapter_path.patch
Log:
Modify ACPI battery status reading patch in debian/patches to work with
newer kernels and properly detect AC on/off.
(Debian bug #343159)
Modified: goodies/xfce4-battery-plugin/debian/patches/00_proc_ac_adapter_path.patch
===================================================================
--- goodies/xfce4-battery-plugin/debian/patches/00_proc_ac_adapter_path.patch 2005-12-17 18:22:09 UTC (rev 355)
+++ goodies/xfce4-battery-plugin/debian/patches/00_proc_ac_adapter_path.patch 2005-12-17 21:14:54 UTC (rev 356)
@@ -1,13 +1,37 @@
---- panel-plugin/libacpi.c.old 2005-01-23 21:58:25.000000000 +0100
-+++ panel-plugin/libacpi.c 2005-01-23 21:59:33.000000000 +0100
-@@ -277,7 +277,9 @@
- if (!(acpi = fopen ("/proc/acpi/ac_adapter/ACAD/state", "r")))
- if (!(acpi = fopen ("/proc/acpi/ac_adapter/AC/state", "r")))
- if (!(acpi = fopen ("/proc/acpi/ac_adapter/ADP1/state", "r")))
+--- panel-plugin/libacpi.c.old 2003-09-09 16:49:16.000000000 +0300
++++ panel-plugin/libacpi.c 2005-10-07 18:05:53.000000000 +0300
+@@ -272,12 +272,29 @@
+ FILE *acpi;
+ char *ptr;
+ char stat;
++ DIR *acdir;
++ struct dirent *ac;
++ char *name;
++ char acstatus[128];
++
++ acdir = opendir("/proc/acpi/ac_adapter");
++ if (!acdir)
++ return -1;
++/* Works with ACPI versions newer than feb 2002, but this is for 2.6 kernels only anyway */
++ while(ac = readdir(acdir)) {
++
++ name = ac->d_name;
++
++ /* skip . and .. */
++ if (name[0] == '.')
++ continue;
++ sprintf (acstatus, "/proc/acpi/ac_adapter/%s/state", name);
++ if (!(acpi = fopen (acstatus, "r")))
++ return -1;
++ break;
++ }
+
+- if (!(acpi = fopen ("/proc/acpi/ac_adapter/0/status", "r")))
+- if (!(acpi = fopen ("/proc/acpi/ac_adapter/ACAD/state", "r")))
+- if (!(acpi = fopen ("/proc/acpi/ac_adapter/AC/state", "r")))
+- if (!(acpi = fopen ("/proc/acpi/ac_adapter/ADP1/state", "r")))
- return -1;
-+ if (!(acpi = fopen ("/proc/acpi/ac_adapter/ADP0/state", "r")))
-+ if (!(acpi = fopen ("/proc/acpi/ac_adapter/C11B/state", "r")))
-+ return -1;
++ closedir(acdir);
fread (buf, 512, 1, acpi);
fclose (acpi);
More information about the Pkg-xfce-commits
mailing list