rpms/xfce4-battery-plugin/devel xfce4-battery-plugin-0.5.0-acpi.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-use-sysfs.patch, NONE, 1.1 xfce4-battery-plugin.spec, 1.14, 1.15
Christoph Wickert (cwickert)
fedora-extras-commits at redhat.com
Sat Apr 5 15:41:41 UTC 2008
- Previous message (by thread): rpms/sear/devel sear-0.6.3-sigc2.patch,NONE,1.1 sear.spec,1.8,1.9
- Next message (by thread): rpms/xfce4-battery-plugin/F-8 xfce4-battery-plugin-0.5.0-acpi.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch, NONE, 1.1 xfce4-battery-plugin.spec, 1.13, 1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: cwickert
Update of /cvs/pkgs/rpms/xfce4-battery-plugin/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13288
Modified Files:
xfce4-battery-plugin.spec
Added Files:
xfce4-battery-plugin-0.5.0-acpi.patch
xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch
xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch
xfce4-battery-plugin-0.5.0-use-sysfs.patch
Log Message:
* Sat Apr 05 2008 Christoph Wickert <fedora christoph-wickert de> - 0.5.0-4
- Fix for kernel 2.6.24 (bugzilla.xfce.org #3938)
- Lower acpi polling. (bugzilla.xfce.org #2948)
- Rebuild with gcc 4.3.0
xfce4-battery-plugin-0.5.0-acpi.patch:
--- NEW FILE xfce4-battery-plugin-0.5.0-acpi.patch ---
diff -urN xfce4-battery-plugin-0.5.0/panel-plugin/libacpi.c xfce4-battery-plugin-0.5.0-new/panel-plugin/libacpi.c
--- xfce4-battery-plugin-0.5.0/panel-plugin/libacpi.c 2007-01-17 18:56:51.000000000 +0100
+++ xfce4-battery-plugin-0.5.0-new/panel-plugin/libacpi.c 2007-07-25 12:03:41.000000000 +0200
@@ -190,10 +190,12 @@
#ifdef __linux__
FILE *acpi;
- if (!(acpi = fopen ("/proc/acpi/info", "r")))
+ if (!(acpi = fopen ("/proc/acpi/info", "r")) &&
+ !(acpi = fopen ("/sys/module/acpi/parameters/acpica_version", "r")))
{
#ifdef DEBUG
- printf("DBG:no acpi: /proc/acpi/info not found!\n");
+ printf("DBG:no acpi: /proc/acpi/info or "
+ "/sys/module/acpi/parameters/acpica_version not found!\n");
#endif
return 1;
}
xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch:
--- NEW FILE xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch ---
--- xfce4-battery-plugin-0.5.0/panel-plugin/libapm.h.orig 2008-03-18 20:10:58.000000000 +0100
+++ xfce4-battery-plugin-0.5.0/panel-plugin/libapm.h 2008-03-18 20:14:45.000000000 +0100
@@ -17,8 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <linux/apm_bios.h>
#include <sys/types.h>
+#include <linux/apm_bios.h>
#define APM_PROC "/proc/apm"
#define APM_DEVICE "/dev/apm_bios"
xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch:
--- NEW FILE xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch ---
Index: panel-plugin/battery.c
===================================================================
--- panel-plugin/battery.c (revision 3481)
+++ panel-plugin/battery.c (working copy)
@@ -326,14 +326,14 @@
}
else
#endif
- battmon->timeoutid = g_timeout_add(2 * 1024,
+ battmon->timeoutid = g_timeout_add(10 * 1024,
(GSourceFunc) update_apm_status, battmon);
}
/* Show initial state if using ACPI rather than waiting a minute */
if(battmon->flag) {
g_source_remove(battmon->timeoutid);
- battmon->timeoutid = g_timeout_add(2 * 1024,
+ battmon->timeoutid = g_timeout_add(10 * 1024,
(GSourceFunc) update_apm_status, battmon);
}
@@ -739,7 +739,7 @@
gtk_container_remove(GTK_CONTAINER(battmon->ebox), GTK_WIDGET(battmon->vbox));
setup_battmon(battmon,orientation);
update_apm_status( battmon );
- battmon->timeoutid = g_timeout_add(1 * 1024, (GSourceFunc) update_apm_status, battmon);
+ battmon->timeoutid = g_timeout_add(10 * 1024, (GSourceFunc) update_apm_status, battmon);
return TRUE;
}
@@ -1405,7 +1405,7 @@
if(battmon->method == BM_USE_ACPI) {
battmon->flag = TRUE;
g_source_remove(battmon->timeoutid);
- battmon->timeoutid = g_timeout_add(1000, (GSourceFunc) update_apm_status, battmon);
+ battmon->timeoutid = g_timeout_add(10 * 1024, (GSourceFunc) update_apm_status, battmon);
}
}
xfce4-battery-plugin-0.5.0-use-sysfs.patch:
--- NEW FILE xfce4-battery-plugin-0.5.0-use-sysfs.patch ---
=== modified file 'panel-plugin/libacpi.c'
--- panel-plugin/libacpi.c 2007-09-03 14:54:36 +0000
+++ panel-plugin/libacpi.c 2007-09-03 15:09:41 +0000
@@ -54,6 +54,7 @@
static char batteries[MAXBATT][128];
static char battinfo[MAXBATT][128];
+
#ifndef __linux__
#if HAVE_SYSCTL
static int
@@ -181,9 +182,56 @@
#endif
#endif
+int check_acpi_sysfs(void)
+{
+ DIR *sysfs;
+ struct dirent *batt;
+ char *name;
+
+ sysfs = opendir("/sys/class/power_supply");
+ if (sysfs == 0)
+ {
+#ifdef DEBUG
+ printf("DBG:No acpi support for sysfs. Trying procfs...\n");
+#endif
+ return 2;
+ }
+ while ((batt = readdir(sysfs)))
+ {
+ name = batt->d_name;
+ if (!strncmp(".", name, 1) || !strncmp("..", name, 2) || (strstr(name,"AC") != NULL) ) continue;
+
+ sprintf(batteries[batt_count], "/sys/class/power_supply/%s", name);
+#ifdef DEBUG
+ printf("DBG:battery number %d at:\n",batt_count);
+ printf("DBG:sysfs dir->%s\n",batteries[batt_count]);
+ printf("DBG:------------------------\n");
+#endif
+ batt_count++;
+ }
+ closedir(sysfs);
+ if ( batt_count == 0 )
+ {
+#ifdef DEBUG
+ printf("DBG:No acpi support for sysfs. Trying procfs...\n");
+#endif
+ acpi_sysfs = 0;
+ return 2;
+ }
+ else
+ {
+ acpi_sysfs = 1;
+ return 0;
+ }
+}
+
/* see if we have ACPI support */
int check_acpi(void)
{
+#ifdef __linux__
+ if ( check_acpi_sysfs() == 0 )
+ return 0;
+#endif
DIR *battdir;
struct dirent *batt;
char *name;
@@ -264,9 +312,75 @@
#endif
}
+int read_sysfs_int(char* filename)
+{
+ FILE* f;
+ f = fopen(filename,"r");
+ if ( !f )
+ {
+#ifdef DEBUG
+ printf("DBG:Could not open %s\n",filename);
+#endif
+ return 0;
+ }
+ int out;
+ fscanf(f,"%d",&out);
+ fclose(f);
+ return out;
+}
+
+char* read_sysfs_string(char* filename)
+{
+ FILE* f;
+ f = fopen(filename,"r");
+ if ( !f )
+ {
+#ifdef DEBUG
+ printf("DBG:Could not open %s\n",filename);
+#endif
+ return NULL;
+ }
+ fscanf(f,"%s",buf2);
+ fclose(f);
+ return buf2;
+}
+
+int read_acad_state_sysfs(void)
+{
+ DIR *sysfs;
+ struct dirent *propety;
+ char *name;
+
+ sysfs = opendir("/sys/class/power_supply/AC");
+ if (sysfs == 0)
+ {
+#ifdef DEBUG
+ printf("DBG:Can't open /sys/class/power_supply/AC");
+#endif
+ return 0;
+ }
+
+ if (!acadstate) acadstate=(ACADstate *)malloc(sizeof(ACADstate));
+
+ while ((propety = readdir(sysfs)))
+ {
+ name = propety->d_name;
+ if (!strncmp(".", name, 1) || !strncmp("..", name, 2)) continue;
+
+ if (strcmp(name,"online") == 0)
+ {
+ acadstate->state = ( read_sysfs_int("/sys/class/power_supply/AC/online") == 1 ) ;
+ }
+ }
+ closedir(sysfs);
+ return acadstate->state;
+}
+
int read_acad_state(void)
{
#ifdef __linux__
+ if (acpi_sysfs)
+ return read_acad_state_sysfs();
FILE *acpi;
char *ptr;
char stat;
@@ -356,20 +470,79 @@
#endif
}
+int read_acpi_info_sysfs(int battery)
+{
+ DIR *sysfs;
+ struct dirent *propety;
+ char *name;
+
+ sysfs = opendir(batteries[battery]);
+ if (sysfs == 0)
+ {
+#ifdef DEBUG
+ printf("DBG:Can't open %s!\n", batteries[battery]);
+#endif
+ return 0;
+ }
+
+ if (!acpiinfo) acpiinfo=(ACPIinfo *)malloc(sizeof(ACPIinfo));
+
+ while ((propety = readdir(sysfs)))
+ {
+ name = propety->d_name;
+ if (!strncmp(".", name, 1) || !strncmp("..", name, 2)) continue;
+
+ if (strcmp(name,"energy_full") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpiinfo->last_full_capacity = read_sysfs_int(buf);
+ }
+ if (strcmp(name,"energy_full_design") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpiinfo->design_capacity = read_sysfs_int(buf);
+ }
+ if (strcmp(name,"technology") == 0)
+ {
+ char *tmp;
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ tmp = read_sysfs_string(buf);
+ if (tmp != NULL)
+ {
+ if (strcmp(tmp,"Li-ion") == 0)
+ acpiinfo->battery_technology = 1;
+ else
+ acpiinfo->battery_technology = 0;
+ }
+ }
+ if (strcmp(name,"present") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpiinfo->present = read_sysfs_int(buf);
+ }
+ }
+ closedir(sysfs);
+ return acpiinfo->present;
+}
+
int read_acpi_info(int battery)
{
#ifdef __linux__
- FILE *acpi;
- char *ptr;
- char stat;
- int temp;
-
if (battery > MAXBATT) {
#ifdef DEBUG
printf("DBG: error, battery > MAXBATT (%d)\n",MAXBATT);
#endif
return 0;
}
+
+ if (acpi_sysfs)
+ return read_acpi_info_sysfs(battery);
+
+ FILE *acpi;
+ char *ptr;
+ char stat;
+ int temp;
+
if (!(acpi = fopen (battinfo[battery], "r"))) {
#ifdef DEBUG
printf("DBG:cannot open %s for read!\n",battinfo[battery]);
@@ -516,9 +689,76 @@
}
+int read_acpi_state_sysfs(int battery)
+{
+ DIR *sysfs;
+ struct dirent *propety;
+ char *name;
+
+ sysfs = opendir(batteries[battery]);
+ if (sysfs == 0)
+ {
+#ifdef DEBUG
+ printf("DBG:Can't open %s!\n", batteries[battery]);
+#endif
+ return 0;
+ }
+
+ if (!acpistate) acpistate=(ACPIstate *)malloc(sizeof(ACPIstate));
+
+ while ((propety = readdir(sysfs)))
+ {
+ name = propety->d_name;
+ if (!strncmp(".", name, 1) || !strncmp("..", name, 2)) continue;
+
+ if (strcmp(name,"status") == 0)
+ {
+ char *tmp;
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ tmp = read_sysfs_string(buf);
+ if ( tmp != NULL )
+ {
+ if (strcmp(tmp,"Charging") == 0)
+ acpistate->state = CHARGING;
+ else if (strcmp(tmp,"Discharging") == 0)
+ acpistate->state = DISCHARGING;
+ else if (strcmp(tmp,"Full") == 0)
+ acpistate->state = POWER;
+ else
+ acpistate->state = UNKNOW;
+ }
+ }
+ if (strcmp(name,"energy_now") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpistate->rcapacity = read_sysfs_int(buf);
+ acpistate->percentage = (((float) acpistate->rcapacity)/acpiinfo->last_full_capacity) * 100;
+ }
+ if (strcmp(name,"current_now") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpistate->prate = read_sysfs_int(buf);
+ if ( acpistate->prate < 0 )
+ acpistate->prate = 0;
+ if ( acpistate->prate > 0 )
+ acpistate->rtime = (((float) acpistate->rcapacity) / acpistate->prate) * 60;
+ }
+ if (strcmp(name,"voltage_now") == 0)
+ {
+ sprintf(buf,"%s/%s",batteries[battery], name);
+ acpistate->pvoltage = read_sysfs_int(buf);
+ }
+ }
+ closedir(sysfs);
+ return acpiinfo->present;
+}
+
int read_acpi_state(int battery)
{
#ifdef __linux__
+ if (acpi_sysfs)
+ return read_acpi_state_sysfs(battery);
+
FILE *acpi;
char *ptr;
char stat;
=== modified file 'panel-plugin/libacpi.h'
--- panel-plugin/libacpi.h 2007-09-03 14:54:36 +0000
+++ panel-plugin/libacpi.h 2007-09-03 15:09:41 +0000
@@ -80,6 +80,8 @@
int batt_count;
/* temp buffer */
char buf[512];
+char buf2[512];
+int acpi_sysfs;
#else
extern int batt_count;
extern ACPIstate *acpistate;
Index: xfce4-battery-plugin.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xfce4-battery-plugin/devel/xfce4-battery-plugin.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- xfce4-battery-plugin.spec 18 Feb 2008 23:42:06 -0000 1.14
+++ xfce4-battery-plugin.spec 5 Apr 2008 15:41:02 -0000 1.15
@@ -8,6 +8,9 @@
URL: http://goodies.xfce.org/projects/panel-plugins/%{name}
Source0: http://goodies.xfce.org/releases/%{name}/%{name}-%{version}.tar.bz2
Patch0: %{name}-0.5.0-acpi.patch
+Patch1: %{name}-0.5.0-fix-ftbfs-2.6.24.patch
+Patch2: %{name}-0.5.0-lower-acpi-polling.patch
+#Patch3: %{name}-0.5.0-use-sysfs.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: xfce4-panel-devel >= 4.3.90.2, libxfcegui4-devel >= 4.3.90.2, libxml2-devel
@@ -20,6 +23,9 @@
%prep
%setup -q
%patch0 -p1 -b .acpi
+%patch1 -p1 -b .2.6.24
+%patch2 -p0 -b .lower-acpi-polling
+#%patch3 -p0 -b .use-sysfs
%build
%configure --disable-static
@@ -50,8 +56,10 @@
%{_datadir}/icons/hicolor/scalable/devices/battery.svg
%changelog
-* Mon Feb 18 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 0.5.0-4
-- Autorebuild for GCC 4.3
+* Sat Apr 05 2008 Christoph Wickert <fedora christoph-wickert de> - 0.5.0-4
+- Fix for kernel 2.6.24 (bugzilla.xfce.org #3938)
+- Lower acpi polling. (bugzilla.xfce.org #2948)
+- Rebuild with gcc 4.3.0
* Tue Aug 28 2007 Christoph Wickert <fedora christoph-wickert de> - 0.5.0-3
- Fix for x86_64 kernels >= 2.6.21. (bugzilla.xfce.org #3190)
- Previous message (by thread): rpms/sear/devel sear-0.6.3-sigc2.patch,NONE,1.1 sear.spec,1.8,1.9
- Next message (by thread): rpms/xfce4-battery-plugin/F-8 xfce4-battery-plugin-0.5.0-acpi.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-fix-ftbfs-2.6.24.patch, NONE, 1.1 xfce4-battery-plugin-0.5.0-lower-acpi-polling.patch, NONE, 1.1 xfce4-battery-plugin.spec, 1.13, 1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list