From db9098f641fc6be714d94d0e7800f3b3511f9028 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 26 Jul 2006 06:00:10 +0000 Subject: Fix the setting of CPU frequency. git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@6827 df743ca5-7f9a-e211-a948-0013205c9059 --- x11/gnome-applets/Makefile | 4 +- .../files/patch-cpufreq-selector-freebsd | 183 ++++++++++----------- 2 files changed, 92 insertions(+), 95 deletions(-) (limited to 'x11') diff --git a/x11/gnome-applets/Makefile b/x11/gnome-applets/Makefile index 7bcf0210e..dc724ae5d 100644 --- a/x11/gnome-applets/Makefile +++ b/x11/gnome-applets/Makefile @@ -3,12 +3,12 @@ # Whom: Joe Marcus Clarke # # $FreeBSD$ -# $MCom: ports/x11/gnome-applets/Makefile,v 1.125 2006/07/21 20:47:01 mezz Exp $ +# $MCom: ports/x11/gnome-applets/Makefile,v 1.126 2006/07/25 02:50:05 ahze Exp $ # PORTNAME= gnome-applets PORTVERSION= 2.15.1.1 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} diff --git a/x11/gnome-applets/files/patch-cpufreq-selector-freebsd b/x11/gnome-applets/files/patch-cpufreq-selector-freebsd index 75d4af0ac..8a7ea857c 100644 --- a/x11/gnome-applets/files/patch-cpufreq-selector-freebsd +++ b/x11/gnome-applets/files/patch-cpufreq-selector-freebsd @@ -42,99 +42,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-selector-sysfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpufreq-selector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ ---- cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.c.orig Sat Jun 24 01:52:35 2006 -+++ cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.c Sat Jun 24 02:09:38 2006 -@@ -0,0 +1,90 @@ -+/* -+ * Copyright (C) 2001, 2002 Free Software Foundation -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public -+ * License along with this library; if not, write to the Free -+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ * -+ * Authors : Joe Marcus Clarke -+ */ -+ -+#include -+#include -+#include -+ -+#ifdef __FreeBSD__ -+#include -+#include -+#endif /* __FreeBSD__ */ -+ -+#include "cpufreq-selector-sysctl.h" -+ -+static void cpufreq_selector_sysctl_init (CPUFreqSelectorSysctl *selector); -+static void cpufreq_selector_sysctl_class_init (CPUFreqSelectorSysctlClass *klass); -+ -+static gboolean cpufreq_selector_sysctl_set_frequency (CPUFreqSelector *selector, guint frequency, GError **error); -+static gboolean cpufreq_selector_sysctl_set_governor (CPUFreqSelector *selector, const gchar *governor, GError **error); -+ -+G_DEFINE_TYPE (CPUFreqSelectorSysctl, cpufreq_selector_sysctl, CPUFREQ_TYPE_SELECTOR) -+ -+static void -+cpufreq_selector_sysctl_init (CPUFreqSelectorSysctl *selector) -+{ -+} -+ -+static void -+cpufreq_selector_sysctl_class_init (CPUFreqSelectorSysctlClass *klass) -+{ -+ CPUFreqSelectorClass *selector_class = CPUFREQ_SELECTOR_CLASS (klass); -+ -+ selector_class->set_frequency = cpufreq_selector_sysctl_set_frequency; -+ selector_class->set_governor = cpufreq_selector_sysctl_set_governor; -+} -+ -+CPUFreqSelector * -+cpufreq_selector_sysctl_new (guint cpu) -+{ -+ CPUFreqSelector *selector; -+ -+ selector = CPUFREQ_SELECTOR (g_object_new (CPUFREQ_TYPE_SELECTOR_SYSCTL, -+ "cpu", cpu, NULL)); -+ -+ return selector; -+} -+ -+static gboolean -+cpufreq_selector_sysctl_set_governor (CPUFreqSelector *selector, const gchar *governor, GError **error) -+{ -+ return TRUE; -+} -+ -+static gboolean -+cpufreq_selector_sysctl_set_frequency (CPUFreqSelector *selector, guint frequency, GError **error) -+{ -+ guint cpu, i; -+ size_t len; -+ gchar *freq_oid; -+ -+ g_object_get (G_OBJECT (selector), "cpu", &cpu, NULL); -+ -+ frequency = (guint) ((gdouble) frequency / 1000); /* Convert back to MHz*/ -+ -+ for (i = 0; i < cpu; i++) { -+ freq_oid = g_strdup_printf ("dev.cpu.%d.freq", (gint) i); -+ -+ sysctlbyname (freq_oid, NULL, &len, &frequency, sizeof (frequency)); -+ g_free (freq_oid); -+ } -+ -+ return TRUE; -+} --- cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.h.orig Sat Jun 24 01:52:35 2006 +++ cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.h Sat Jun 24 02:13:05 2006 @@ -0,0 +1,53 @@ @@ -237,3 +144,93 @@ } else { g_printerr ("No cpufreq support\n"); return 1; +--- cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.c.orig Wed Jul 26 01:34:18 2006 ++++ cpufreq/src/cpufreq-selector/cpufreq-selector-sysctl.c Wed Jul 26 01:42:00 2006 +@@ -0,0 +1,87 @@ ++/* ++ * Copyright (C) 2001, 2002 Free Software Foundation ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public ++ * License along with this library; if not, write to the Free ++ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ * Authors : Joe Marcus Clarke ++ */ ++ ++#include ++#include ++#include ++ ++#ifdef __FreeBSD__ ++#include ++#include ++#endif /* __FreeBSD__ */ ++ ++#include "cpufreq-selector-sysctl.h" ++ ++static void cpufreq_selector_sysctl_init (CPUFreqSelectorSysctl *selector); ++static void cpufreq_selector_sysctl_class_init (CPUFreqSelectorSysctlClass *klass); ++ ++static gboolean cpufreq_selector_sysctl_set_frequency (CPUFreqSelector *selector, guint frequency, GError **error); ++static gboolean cpufreq_selector_sysctl_set_governor (CPUFreqSelector *selector, const gchar *governor, GError **error); ++ ++G_DEFINE_TYPE (CPUFreqSelectorSysctl, cpufreq_selector_sysctl, CPUFREQ_TYPE_SELECTOR) ++ ++static void ++cpufreq_selector_sysctl_init (CPUFreqSelectorSysctl *selector) ++{ ++} ++ ++static void ++cpufreq_selector_sysctl_class_init (CPUFreqSelectorSysctlClass *klass) ++{ ++ CPUFreqSelectorClass *selector_class = CPUFREQ_SELECTOR_CLASS (klass); ++ ++ selector_class->set_frequency = cpufreq_selector_sysctl_set_frequency; ++ selector_class->set_governor = cpufreq_selector_sysctl_set_governor; ++} ++ ++CPUFreqSelector * ++cpufreq_selector_sysctl_new (guint cpu) ++{ ++ CPUFreqSelector *selector; ++ ++ selector = CPUFREQ_SELECTOR (g_object_new (CPUFREQ_TYPE_SELECTOR_SYSCTL, ++ "cpu", cpu, NULL)); ++ ++ return selector; ++} ++ ++static gboolean ++cpufreq_selector_sysctl_set_governor (CPUFreqSelector *selector, const gchar *governor, GError **error) ++{ ++ return TRUE; ++} ++ ++static gboolean ++cpufreq_selector_sysctl_set_frequency (CPUFreqSelector *selector, guint frequency, GError **error) ++{ ++ guint cpu, i; ++ size_t len; ++ gchar *freq_oid; ++ ++ g_object_get (G_OBJECT (selector), "cpu", &cpu, NULL); ++ ++ frequency = (guint) ((gdouble) frequency / 1000); /* Convert back to MHz*/ ++ freq_oid = g_strdup_printf ("dev.cpu.%d.freq", (gint) cpu); ++ ++ sysctlbyname (freq_oid, NULL, &len, &frequency, sizeof (frequency)); ++ g_free (freq_oid); ++ ++ return TRUE; ++} -- cgit v1.2.3