From 15366306a0eb6be860cd219fb15656c006e28d52 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 14 Feb 2005 01:45:28 +0000 Subject: Another battstat fix to reduce CPU usage by not actually installing the a timeout handler recursively. I'm holding off on the PORTREVISION bump as I have more cpufreq changes in the works. Tested by: sajd on #freebsd-gnome git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3649 df743ca5-7f9a-e211-a948-0013205c9059 --- x11/gnome-applets/files/patch-battstat-acpi | 33 +++++++++-------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'x11/gnome-applets') diff --git a/x11/gnome-applets/files/patch-battstat-acpi b/x11/gnome-applets/files/patch-battstat-acpi index 7c8e5d413..38aa935c1 100644 --- a/x11/gnome-applets/files/patch-battstat-acpi +++ b/x11/gnome-applets/files/patch-battstat-acpi @@ -66,7 +66,7 @@ + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * -+ $Id: patch-battstat-acpi,v 1.8 2005-02-13 06:46:10 marcus Exp $ ++ $Id: patch-battstat-acpi,v 1.9 2005-02-14 01:45:28 marcus Exp $ + */ + +/* @@ -322,8 +322,8 @@ }; --- battstat/power-management.c.orig Thu Jan 13 23:06:40 2005 -+++ battstat/power-management.c Sun Feb 13 01:42:21 2005 -@@ -76,6 +76,24 @@ ++++ battstat/power-management.c Sun Feb 13 20:44:23 2005 +@@ -76,6 +76,14 @@ #ifdef __FreeBSD__ #include @@ -332,23 +332,13 @@ +struct acpi_info acpiinfo; +gboolean using_acpi; +int acpi_count; -+int acpiwatch; +struct apm_info apminfo; + +gboolean acpi_freebsd_read(struct apm_info *apminfo, struct acpi_info *acpiinfo); -+ -+gboolean acpi_callback (gpointer data) -+{ -+ if (acpi_process_event(&acpiinfo)) { -+ acpi_freebsd_read(&apminfo, &acpiinfo); -+ } -+ -+ return TRUE; -+} #define APMDEVICE "/dev/apm" -@@ -86,25 +104,37 @@ +@@ -86,25 +94,37 @@ FreeBSD. Each time this functions is called (once every second) the APM device is opened, read from and then closed. */ @@ -383,21 +373,21 @@ - close(fd); + close(fd); ++ ++ if(apminfo.ai_status == 0) ++ return ERR_APM_E; - if(apminfo.ai_status == 0) - return ERR_APM_E; -+ if(apminfo.ai_status == 0) -+ return ERR_APM_E; -+ + } + + if (using_acpi) { -+ acpiwatch = g_timeout_add (5000, acpi_callback, NULL); ++ acpi_freebsd_read(&apminfo, &acpiinfo); + } status->present = TRUE; status->on_ac_power = apminfo.ai_acline ? 1 : 0; -@@ -339,6 +369,13 @@ +@@ -339,6 +359,13 @@ G_IO_IN | G_IO_ERR | G_IO_HUP, acpi_callback, NULL); } @@ -411,16 +401,13 @@ #endif pm_initialised = 1; -@@ -360,6 +397,13 @@ +@@ -360,6 +387,10 @@ g_source_remove(acpiwatch); acpiwatch = 0; acpi_linux_cleanup(&acpiinfo); + } +#elif defined(__FreeBSD__) + if (using_acpi) { -+ if (acpiwatch != 0) -+ g_source_remove(acpiwatch); -+ acpiwatch = 0; + acpi_freebsd_cleanup(&acpiinfo); } #endif -- cgit v1.2.3