summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO18
-rw-r--r--619913.patch55
-rw-r--r--cpufreqd35
-rw-r--r--cpufreqd_acpi_battery.c.patch176
-rw-r--r--cpupower.patch24
5 files changed, 62 insertions, 246 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 1acf6326a49f..0f17b8ea9959 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,26 +1,22 @@
pkgbase = cpufreqd
pkgdesc = A small daemon to adjust cpu speed (and indeed voltage)
pkgver = 2.4.2
- pkgrel = 10
- url = http://www.linux.it/~malattia/wiki/index.php/Cpufreqd
+ pkgrel = 11
+ url = http://kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html
arch = i686
arch = x86_64
license = GPL2
makedepends = autoconf
- depends = cpupower
depends = lm_sensors
+ depends = cpufrequtils
options = !libtool
backup = etc/cpufreqd.conf
- source = http://downloads.sourceforge.net/cpufreqd/cpufreqd-2.4.2.tar.bz2
- source = cpufreqd
+ source = http://deb.debian.org/debian/pool/main/c/cpufreqd/cpufreqd_2.4.2.orig.tar.bz2
source = cpufreqd.service
- source = cpufreqd_acpi_battery.c.patch
- source = cpupower.patch
- md5sums = 2ca80a77849c9a69b81e27c1843c97f5
- md5sums = 4d0fafbdb5f1b7313fdeb6f1250ef34f
+ source = 619913.patch
+ md5sums = 038a3254044ead9944d9a04bcc94b5f4
md5sums = 4213dced234d7700dd012d3f63349cd1
- md5sums = d0df76dce1bc6cc021b199f820b748b9
- md5sums = cbc349fa8d4e83a45e9c9e45356648be
+ md5sums = 4183ae46467f27f5815f151b136183f5
pkgname = cpufreqd
diff --git a/619913.patch b/619913.patch
new file mode 100644
index 000000000000..62592d3d7d91
--- /dev/null
+++ b/619913.patch
@@ -0,0 +1,55 @@
+From: Roland Hieber <rohieb@rohieb.name>
+Subject: Use power_now instead of current_now to read power from sysfs
+
+Apparently, current_now was renamed to power_now around kernel 2.6.36. The fix
+in this patch first tries to read from the new file name, if this does not
+exist, it tries the old name.
+
+Bug: 644567
+Author: niko2gare <http://sourceforge.net/users/niko2gare/>
+Origin: http://sourceforge.net/tracker/?func=detail&aid=3172707&group_id=58904&atid=489239
+Last-Update: 2012-10-12
+
+Modification to avoid checking closed battery
+From: Bernd Rinn (z-bb)
+Origin: https://bugs.launchpad.net/ubuntu/+source/cpufreqd/+bug/733507/+attachment/3022414/+files/cpufreqd-bug%23733507.patch
+Index: cpufreqd/src/cpufreqd_acpi_battery.c
+===================================================================
+--- cpufreqd.orig/src/cpufreqd_acpi_battery.c 2013-03-23 21:37:28.268379010 +0900
++++ cpufreqd/src/cpufreqd_acpi_battery.c 2013-03-23 21:38:23.392952250 +0900
+@@ -36,6 +36,7 @@
+ #define PRESENT "present"
+ #define STATUS "status"
+ #define CURRENT_NOW "current_now"
++#define POWER_NOW "power_now"
+
+ struct battery_info {
+ int capacity;
+@@ -145,9 +146,13 @@
+ binfo->status = get_class_device_attribute(binfo->cdev, STATUS);
+ if (!binfo->status)
+ return -1;
+- binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW);
+- if (!binfo->current_now)
+- return -1;
++ binfo->current_now = get_class_device_attribute(binfo->cdev, POWER_NOW);
++ if (!binfo->current_now) {
++ /* try the "current_now" name */
++ binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW);
++ if (!binfo->current_now)
++ return -1;
++ }
+
+ /* read the last full capacity, this is not going to change
+ * very often, so no need to poke it later */
+@@ -311,6 +316,10 @@
+
+ /* Read battery informations */
+ for (i = 0; i < bat_dir_num; i++) {
++ if (!info[i].open) {
++ clog(LOG_INFO, "Skipping %s (closed)\n", info[i].cdev->name);
++ continue;
++ }
+
+ if (read_int(info[i].present, &info[i].is_present) != 0) {
+ clog(LOG_INFO, "Skipping %s\n", info[i].cdev->name);
diff --git a/cpufreqd b/cpufreqd
deleted file mode 100644
index d2f2a89bf6e6..000000000000
--- a/cpufreqd
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pidof -o %PPID /usr/bin/cpufreqd`
-case "$1" in
- start)
- stat_busy "Starting cpufreqd"
- [ -z "$PID" ] && /usr/bin/cpufreqd
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon cpufreqd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping cpufreqd"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon cpufreqd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
diff --git a/cpufreqd_acpi_battery.c.patch b/cpufreqd_acpi_battery.c.patch
deleted file mode 100644
index 51f63532d1e9..000000000000
--- a/cpufreqd_acpi_battery.c.patch
+++ /dev/null
@@ -1,176 +0,0 @@
---- src/cpufreqd_acpi_battery.c 2010-03-28 04:34:54.000000000 -0700
-+++ src/cpufreqd_acpi_battery.c 2010-11-21 18:51:32.000000000 -0800
-@@ -29,12 +29,15 @@
-
- #define POWER_SUPPLY "power_supply"
- #define BATTERY_TYPE "Battery"
-+#define PRESENT "present"
-+#define STATUS "status"
-+//energy batter properties
- #define ENERGY_FULL "energy_full"
- #define ENERGY_NOW "energy_now"
-+#define POWER_NOW "power_now"
-+//charge battery properties
- #define CHARGE_FULL "charge_full"
- #define CHARGE_NOW "charge_now"
--#define PRESENT "present"
--#define STATUS "status"
- #define CURRENT_NOW "current_now"
-
- struct battery_info {
-@@ -45,11 +48,11 @@
- int is_present;
-
- struct sysfs_class_device *cdev;
-- struct sysfs_attribute *energy_full; /* last full capacity */
-- struct sysfs_attribute *energy_now; /* remaining capacity */
-+ struct sysfs_attribute *full_capacity; /* last full capacity */
-+ struct sysfs_attribute *remaining_capacity; /* remaining capacity */
- struct sysfs_attribute *present;
- struct sysfs_attribute *status;
-- struct sysfs_attribute *current_now; /* present rate */
-+ struct sysfs_attribute *draw_rate; /* present rate */
-
- int open;
- };
-@@ -87,16 +90,16 @@
-
- if (!binfo->open) return;
-
-- if (binfo->energy_full)
-- put_attribute(binfo->energy_full);
-- if (binfo->energy_now)
-- put_attribute(binfo->energy_now);
-+ if (binfo->full_capacity)
-+ put_attribute(binfo->full_capacity);
-+ if (binfo->remaining_capacity)
-+ put_attribute(binfo->remaining_capacity);
- if (binfo->present)
- put_attribute(binfo->present);
- if (binfo->status)
- put_attribute(binfo->status);
-- if (binfo->current_now)
-- put_attribute(binfo->current_now);
-+ if (binfo->draw_rate)
-+ put_attribute(binfo->draw_rate);
-
- binfo->open = 0;
- }
-@@ -104,11 +107,11 @@
- static int read_battery(struct battery_info *binfo) {
- clog(LOG_DEBUG, "%s - reading battery levels\n", binfo->cdev->name);
-
-- if (read_int(binfo->current_now, &binfo->present_rate) != 0) {
-+ if (read_int(binfo->draw_rate, &binfo->present_rate) != 0) {
- clog(LOG_ERR, "Skipping %s\n", binfo->cdev->name);
- return -1;
- }
-- if (read_int(binfo->energy_now, &binfo->remaining) != 0) {
-+ if (read_int(binfo->remaining_capacity, &binfo->remaining) != 0) {
- clog(LOG_ERR, "Skipping %s\n", binfo->cdev->name);
- return -1;
- }
-@@ -120,38 +123,88 @@
- binfo->cdev->name, binfo->remaining);
- return 0;
- }
-+
-+/* open energy battery specific attributes */
-+static int read_energy_battery_attributes(struct battery_info *binfo)
-+{
-+ binfo->full_capacity = get_class_device_attribute(binfo->cdev, ENERGY_FULL);
-+ if(!binfo->full_capacity)
-+ {
-+ return -1;
-+ }
-+
-+ binfo->remaining_capacity = get_class_device_attribute(binfo->cdev, ENERGY_NOW);
-+ if(!binfo->remaining_capacity)
-+ {
-+ return -1;
-+ }
-+
-+ binfo->draw_rate = get_class_device_attribute(binfo->cdev, POWER_NOW);
-+ if(!binfo->draw_rate)
-+ {
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+/* open charge battery specific attributes */
-+static int read_charge_battery_attributes(struct battery_info *binfo)
-+{
-+ binfo->full_capacity = get_class_device_attribute(binfo->cdev, CHARGE_FULL);
-+ if(!binfo->full_capacity)
-+ {
-+ return -1;
-+ }
-+
-+ binfo->remaining_capacity = get_class_device_attribute(binfo->cdev, CHARGE_NOW);
-+ if(!binfo->remaining_capacity)
-+ {
-+ return -1;
-+ }
-+
-+ binfo->draw_rate = get_class_device_attribute(binfo->cdev, CURRENT_NOW);
-+ if(!binfo->draw_rate)
-+ {
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
- /* open all the required attributes and set the open status */
- static int open_battery(struct battery_info *binfo) {
- binfo->open = 1;
-
-- binfo->energy_full = get_class_device_attribute(binfo->cdev, ENERGY_FULL);
-- if (!binfo->energy_full) {
-- /* try the "charge_full" name */
-- binfo->energy_full = get_class_device_attribute(binfo->cdev,
-- CHARGE_FULL);
-- if (!binfo->energy_full)
-+ //attempt to open energy attribute
-+ struct sysfs_attribute *tmp_attribute = get_class_device_attribute(binfo->cdev, ENERGY_FULL);
-+
-+ if(!tmp_attribute)
-+ {
-+ if(read_charge_battery_attributes(binfo) != 0)
-+ {
- return -1;
-+ }
- }
-- binfo->energy_now = get_class_device_attribute(binfo->cdev, ENERGY_NOW);
-- if (!binfo->energy_now) {
-- /* try the "charge_now" name */
-- binfo->energy_now = get_class_device_attribute(binfo->cdev, CHARGE_NOW);
-- if (!binfo->energy_now)
-+ else
-+ {
-+ put_attribute(tmp_attribute);
-+ if(read_energy_battery_attributes(binfo) != 0)
-+ {
- return -1;
-+ }
- }
-+
- binfo->present = get_class_device_attribute(binfo->cdev, PRESENT);
- if (!binfo->present)
- return -1;
- binfo->status = get_class_device_attribute(binfo->cdev, STATUS);
- if (!binfo->status)
- return -1;
-- binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW);
-- if (!binfo->current_now)
-- return -1;
-
- /* read the last full capacity, this is not going to change
- * very often, so no need to poke it later */
-- if (read_int(binfo->energy_full, &binfo->capacity) != 0) {
-+ if (read_int(binfo->full_capacity, &binfo->capacity) != 0) {
- clog(LOG_WARNING, "Couldn't read %s capacity (%s)\n",
- binfo->cdev->name, strerror(errno));
- return -1;
diff --git a/cpupower.patch b/cpupower.patch
deleted file mode 100644
index cc9da4405bff..000000000000
--- a/cpupower.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- configure.in 2010-04-18 17:57:30.000000000 +0400
-+++ configure.in 2013-01-04 14:37:44.687427237 +0400
-@@ -4,7 +4,7 @@
-
- AM_INIT_AUTOMAKE(1.8 dist-bzip2 foreign)
- AC_CONFIG_SRCDIR([config.h.in])
--AM_CONFIG_HEADER(config.h)
-+AC_CONFIG_HEADERS(config.h)
-
- # libtool
- AC_LIBTOOL_DLOPEN
-@@ -38,9 +38,9 @@
- AC_CHECK_LIB([dl], [dlopen],
- [ CPUFREQD_LDFLAGS="${CPUFREQD_LDFLAGS} -ldl" ],
- [ AC_MSG_ERROR([You need a working dlopen to build cpufreqd]) ])
--AC_CHECK_LIB([cpufreq], [cpufreq_cpu_exists],
-- [ CPUFREQD_LDFLAGS="${CPUFREQD_LDFLAGS} -lcpufreq" ],
-- [ AC_MSG_ERROR([You need libcpufreq from cpufrequtils to build cpufreqd]) ])
-+AC_CHECK_LIB([cpupower], [cpufreq_get_freq_kernel],
-+ [ CPUFREQD_LDFLAGS="${CPUFREQD_LDFLAGS} -lcpupower" ],
-+ [ AC_MSG_ERROR([You need libcpupower from cpupower to build cpufreqd]) ])
- AC_SUBST(CPUFREQD_LDFLAGS)
-
- DISABLED_PLUGINS=""