summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThilo Bangert <bangert@gentoo.org>2010-01-10 23:34:33 +0000
committerThilo Bangert <bangert@gentoo.org>2010-01-10 23:34:33 +0000
commit09c4485af68c6bca43120c58f7782f5745c1bd4d (patch)
tree7f93100c828b95ace9c9cc8d95ecbdcec98ba5a5 /sys-power
parentGrant netatalk a stay of execution. (diff)
downloadgentoo-2-09c4485af68c6bca43120c58f7782f5745c1bd4d.tar.gz
gentoo-2-09c4485af68c6bca43120c58f7782f5745c1bd4d.tar.bz2
gentoo-2-09c4485af68c6bca43120c58f7782f5745c1bd4d.zip
fix cpu temp detection - bug #295044
(Portage version: 2.2_rc61/cvs/Linux i686)
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/cpufreqd/ChangeLog10
-rw-r--r--sys-power/cpufreqd/cpufreqd-2.3.4-r2.ebuild84
-rw-r--r--sys-power/cpufreqd/files/cpufreqd-2.3.4-lm_sensors-3-r2.patch155
3 files changed, 247 insertions, 2 deletions
diff --git a/sys-power/cpufreqd/ChangeLog b/sys-power/cpufreqd/ChangeLog
index c960f0b71351..312d3a23eb9a 100644
--- a/sys-power/cpufreqd/ChangeLog
+++ b/sys-power/cpufreqd/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-power/cpufreqd
-# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufreqd/ChangeLog,v 1.56 2009/10/27 09:07:18 bangert Exp $
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufreqd/ChangeLog,v 1.57 2010/01/10 23:34:33 bangert Exp $
+
+*cpufreqd-2.3.4-r2 (10 Jan 2010)
+
+ 10 Jan 2010; Thilo Bangert <bangert@gentoo.org> +cpufreqd-2.3.4-r2.ebuild,
+ +files/cpufreqd-2.3.4-lm_sensors-3-r2.patch:
+ fix cpu temp detection - bug #295044
*cpufreqd-2.3.4-r1 (27 Oct 2009)
diff --git a/sys-power/cpufreqd/cpufreqd-2.3.4-r2.ebuild b/sys-power/cpufreqd/cpufreqd-2.3.4-r2.ebuild
new file mode 100644
index 000000000000..38bb0b7252d8
--- /dev/null
+++ b/sys-power/cpufreqd/cpufreqd-2.3.4-r2.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufreqd/cpufreqd-2.3.4-r2.ebuild,v 1.1 2010/01/10 23:34:33 bangert Exp $
+
+EAPI="2"
+
+inherit eutils
+
+NVCLOCK_VERSION="0.8b"
+
+DESCRIPTION="CPU Frequency Daemon"
+HOMEPAGE="http://www.linux.it/~malattia/wiki/index.php/Cpufreqd"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
+ nvidia? ( http://www.linuxhardware.org/nvclock/nvclock${NVCLOCK_VERSION}.tar.gz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="acpi apm lm_sensors nforce2 nvidia pmu"
+RDEPEND=">=sys-power/cpufrequtils-002
+ lm_sensors? ( >sys-apps/lm_sensors-3 )"
+DEPEND="sys-apps/sed
+ ${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-conf.d.patch
+ epatch "${FILESDIR}"/2.2.1-cpu_all.patch
+ use lm_sensors && epatch "${FILESDIR}"/${P}-lm_sensors-3-r2.patch
+
+ if use nvidia; then
+ cd "${WORKDIR}"/nvclock${NVCLOCK_VERSION}
+ epatch "${FILESDIR}"/nvclock${NVCLOCK_VERSION}-fpic.patch
+ fi
+}
+
+src_configure() {
+ local config
+
+ if use nvidia; then
+ cd "${WORKDIR}"/nvclock${NVCLOCK_VERSION}
+ econf \
+ --disable-gtk \
+ --disable-qt \
+ --disable-nvcontrol \
+ || die "econf nvclock failed"
+ emake -j1 || die "emake nvclock failed"
+ config="--enable-nvclock=${WORKDIR}/nvclock${NVCLOCK_VERSION}"
+ fi
+
+ cd "${S}"
+ econf \
+ $(use_enable acpi) \
+ $(use_enable apm) \
+ $(use_enable lm_sensors sensors) \
+ $(use_enable nforce2) \
+ $(use_enable pmu) \
+ ${config} \
+ || die "econf failed"
+}
+
+src_compile() {
+ if use nvidia; then
+ cd "${WORKDIR}"/nvclock${NVCLOCK_VERSION}
+ fi
+
+ cd "${S}"
+ emake || die "make failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "make install failed"
+ rm -rf "${D}"/usr/$(get_libdir)/*.la
+ dodoc AUTHORS ChangeLog NEWS README TODO
+ newinitd "${FILESDIR}"/${PN}-init.d ${PN}
+}
+
+pkg_postinst() {
+ if [ -f "${ROOT}"/etc/conf.d/cpufreqd ] ; then
+ ewarn "An old \"/etc/conf.d/cpufreqd\" file was found. It breaks"
+ ewarn "the new init script! Please remove it."
+ ewarn "# rm /etc/conf.d/cpufreqd"
+ fi
+}
diff --git a/sys-power/cpufreqd/files/cpufreqd-2.3.4-lm_sensors-3-r2.patch b/sys-power/cpufreqd/files/cpufreqd-2.3.4-lm_sensors-3-r2.patch
new file mode 100644
index 000000000000..b3efd6ad2cfa
--- /dev/null
+++ b/sys-power/cpufreqd/files/cpufreqd-2.3.4-lm_sensors-3-r2.patch
@@ -0,0 +1,155 @@
+--- src/cpufreqd_sensors.c.orig 2009-03-21 07:17:15.000000000 -0400
++++ src/cpufreqd_sensors.c 2010-01-10 00:28:50.000000000 -0500
+@@ -23,10 +23,22 @@
+ #include <string.h>
+ #include "cpufreqd_plugin.h"
+
++#if !defined __GNUC__ || __GNUC__ < 3
++#define __attribute__(x)
++#endif
++
++#if SENSORS_API_VERSION < 0x400
++typedef sensors_feature_data sensors_feature;
++#endif
++
+ /* to hold monitored feature list and avoid reading all sensors */
+ struct sensors_monitor {
+ const sensors_chip_name *chip;
+- const sensors_feature_data *feat;
++ char chip_string[MAX_STRING_LEN];
++ const sensors_feature *feat;
++#if SENSORS_API_VERSION >= 0x400
++ const sensors_subfeature *sub_feat;
++#endif
+ double value;
+ struct sensors_monitor *next;
+ };
+@@ -133,27 +145,73 @@
+ struct sensors_monitor *list = monitor_list;
+
+ while (list) {
+- sensors_get_feature(*(list->chip), list->feat->number, &list->value);
+- clog(LOG_INFO, "%s: %.3f\n", list->feat->name, list->value);
++#if SENSORS_API_VERSION >= 0x400
++ if(sensors_get_value(list->chip, list->sub_feat->number, &list->value) < 0) {
++#else
++ if(sensors_get_feature(*(list->chip), list->feat->number, &list->value) < 0) {
++#endif
++ clog(LOG_ERR,"could not read value for %s\n",list->feat->name);
++ return -1;
++ }
++ clog(LOG_INFO, "%s:%s: %.3f\n", list->chip_string, list->feat->name, list->value);
+ list = list->next;
+ }
+
+ return 0;
+ }
+
++
++#if SENSORS_API_VERSION < 0x400
++/* Adapted from lm-sensors 2.10.8 prog/sensors/main.c */
++static int sensors_snprintf_chip_name(char *str, size_t size,
++ const sensors_chip_name *chip)
++{
++ switch(chip->bus) {
++ case SENSORS_CHIP_NAME_BUS_ISA:
++ return snprintf(str,size,"%s-isa-%04x",chip->prefix,chip->addr);
++ case SENSORS_CHIP_NAME_BUS_PCI:
++ return snprintf(str,size,"%s-pci-%04x",chip->prefix,chip->addr);
++ case SENSORS_CHIP_NAME_BUS_DUMMY:
++ return snprintf(str,size,"%s-%s-%04x",chip->prefix,chip->busname,chip->addr);
++ default:
++ return snprintf(str,size,"%s-i2c-%d-%02x",chip->prefix,chip->bus,chip->addr);
++ }
++}
++#endif
++
++__attribute__((unused)) static const char* sensors_get_chip_name(const sensors_chip_name *chip);
++static const char* sensors_get_chip_name(const sensors_chip_name *chip) {
++ static char name[MAX_STRING_LEN];
++ sensors_snprintf_chip_name(name, MAX_STRING_LEN, chip);
++ return name;
++}
++
+ /* this function can be pretty expensive (CPU time)?? */
+ static struct sensors_monitor * validate_feature_name(const char *name) {
+
+ /* get all sensors from first chip */
+ const sensors_chip_name *chip;
+- const sensors_feature_data *feat;
+- int nr = 0, nr1 = 0, nr2 = 0;
++ const sensors_feature *feat;
++ int nr1 = 0, nr2;
++#if SENSORS_API_VERSION >= 0x400
++ const sensors_subfeature *sub_feat;
++#endif
+ struct sensors_monitor *list = monitor_list;
+ struct sensors_monitor *ret = NULL;
+
+ /* scan the full thing */
++#if SENSORS_API_VERSION >= 0x400
++ while ( (chip = sensors_get_detected_chips(NULL, &nr1)) != NULL) {
++ nr2 = 0;
++ while ((feat = sensors_get_features(chip, &nr2)) != NULL) {
++ /* sensor input? */
++ if((sub_feat = sensors_get_subfeature(chip, feat, feat->type << 8)) == NULL) {
++ clog(LOG_DEBUG, "Input subfeature not found for %s, skipping\n", feat->name);
++ continue;
++ }
++#else
+ while ( (chip = sensors_get_detected_chips(&nr)) != NULL) {
+- nr1 = nr2 = 0;
++ nr1 = nr2 = 0;
+ char *label = NULL;
+ clog(LOG_DEBUG, "Examining chip %s(%d)\n", chip->prefix, nr);
+ while ((feat = sensors_get_all_features(*chip, &nr1, &nr2)) != NULL) {
+@@ -164,22 +222,33 @@
+ if (sensors_get_label(*chip, feat->number, &label) != 0)
+ clog(LOG_DEBUG, "Couldn't get label for %s (%s)\n",
+ feat->name, strerror(errno));
++ }
++#endif
+
+ /* is it the one we are looking for? */
+- if (strncmp(feat->name, name, MAX_STRING_LEN) != 0 &&
+- (label && strncmp(label, name, MAX_STRING_LEN) != 0)) {
+- free(label);
++ if (strncmp(feat->name, name, MAX_STRING_LEN) != 0) {
++ continue;
++
++/* libsensors4 does this in sensors_get_features() */
++#if SENSORS_API_VERSION < 0x400
++ /* not ignored? */
++ } else if(sensors_get_ignored(*chip, feat->number) == 0) {
++ clog(LOG_INFO, "feature %s on chip %s set to ignore in %s, skipping\n",
++ feat->name, sensors_get_chip_name(chip), sensors_conffile);
+ continue;
++#endif
+
+ /* cache it */
+ } else if ((ret = calloc(1, sizeof(struct sensors_monitor))) != NULL) {
+- clog(LOG_DEBUG, "Creating new sensors_monitor for %s (%s)\n",
+- label, feat->name);
++ sensors_snprintf_chip_name(ret->chip_string, MAX_STRING_LEN, chip);
++ clog(LOG_DEBUG, "Creating new sensors_monitor for %s on chip %s\n",
++ name, ret->chip_string);
+ ret->chip = chip;
+ ret->feat = feat;
++#if SENSORS_API_VERSION >= 0x400
++ ret->sub_feat = sub_feat;
++#endif
+ ret->next = NULL;
+- /* free the label here, we are not using it anymore */
+- free(label);
+ /* append monitor to the cache list */
+ list = monitor_list;
+ if (list != NULL) {
+@@ -214,7 +283,7 @@
+ clog(LOG_DEBUG, "called with %s\n", ev);
+
+ /* try to parse the %[a-zA-Z0-9]:%d-%d format first */
+- if (sscanf(ev, "%32[^:]:%lf-%lf", ret->name, &ret->min, &ret->max) == 3) {
++ if (sscanf(ev, "%32[a-zA-Z0-9]:%lf-%lf", ret->name, &ret->min, &ret->max) == 3) {
+ /* validate feature name */
+ if ((ret->monitor = validate_feature_name(ret->name)) != NULL) {
+ clog(LOG_INFO, "parsed %s %.3f-%.3f\n", ret->name, ret->min, ret->max);