summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Junghans <ottxor@gentoo.org>2011-12-21 04:51:22 +0000
committerChristoph Junghans <ottxor@gentoo.org>2011-12-21 04:51:22 +0000
commitff8961beb5bfddc78f6a18bacef6bbf88889077a (patch)
treee095d508c6dd19c56fd60e7bf7c84bf48ae2c969 /app-laptop
parentinclude to prevent this trick apply to cross compilers; fix grep pattern aga... (diff)
downloadgentoo-2-ff8961beb5bfddc78f6a18bacef6bbf88889077a.tar.gz
gentoo-2-ff8961beb5bfddc78f6a18bacef6bbf88889077a.tar.bz2
gentoo-2-ff8961beb5bfddc78f6a18bacef6bbf88889077a.zip
fixed bug #334435 and bug #392475
(Portage version: 2.2.0_alpha81/cvs/Linux i686)
Diffstat (limited to 'app-laptop')
-rw-r--r--app-laptop/hdapsd/ChangeLog8
-rw-r--r--app-laptop/hdapsd/files/hdapsd.conf.211
-rw-r--r--app-laptop/hdapsd/files/hdapsd.init.268
-rw-r--r--app-laptop/hdapsd/hdapsd-20090401-r1.ebuild48
4 files changed, 134 insertions, 1 deletions
diff --git a/app-laptop/hdapsd/ChangeLog b/app-laptop/hdapsd/ChangeLog
index ba824360ae22..69175abd0b82 100644
--- a/app-laptop/hdapsd/ChangeLog
+++ b/app-laptop/hdapsd/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-laptop/hdapsd
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/ChangeLog,v 1.17 2011/05/04 15:44:37 tomka Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/ChangeLog,v 1.18 2011/12/21 04:51:22 ottxor Exp $
+
+*hdapsd-20090401-r1 (21 Dec 2011)
+
+ 21 Dec 2011; Christoph Junghans <ottxor@gentoo.org>
+ +hdapsd-20090401-r1.ebuild, +files/hdapsd.conf.2, +files/hdapsd.init.2:
+ fixed bug #334435 and bug #392475
04 May 2011; Thomas Kahle <tomka@gentoo.org> hdapsd-20090401.ebuild:
x86 stable per bug 334737
diff --git a/app-laptop/hdapsd/files/hdapsd.conf.2 b/app-laptop/hdapsd/files/hdapsd.conf.2
new file mode 100644
index 000000000000..2f55a83bae87
--- /dev/null
+++ b/app-laptop/hdapsd/files/hdapsd.conf.2
@@ -0,0 +1,11 @@
+# The list of the disk devices that hdapsd should monitor.
+# Usually this is 'hda', 'sda' or 'hda sda'.
+DISKLIST="sda"
+
+# hdapsd sensitivity
+# The lower the threshold is the earlier
+# the heads are parked when the laptop is shaked
+THRESHOLD="10"
+
+# Set any extra options here, like -a for Adaptive mode
+OPTIONS="-a"
diff --git a/app-laptop/hdapsd/files/hdapsd.init.2 b/app-laptop/hdapsd/files/hdapsd.init.2
new file mode 100644
index 000000000000..579c2291b9d7
--- /dev/null
+++ b/app-laptop/hdapsd/files/hdapsd.init.2
@@ -0,0 +1,68 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+
+depend() {
+ need localmount
+}
+
+checkconfig() {
+ if [[ -n ${DISK} ]]; then
+ ewarn "Please migrate DISK to DISKLIST in /etc/conf.d/hdapsd."
+ DISKLIST=${DISK}
+ fi
+
+ if [[ -z ${DISKLIST} || -z ${THRESHOLD} ]] ; then
+ eerror "You should setup DISKLIST and THRESHOLD in /etc/conf.d/hdapsd."
+ return 1
+ fi
+
+ for DISK in ${DISKLIST}; do
+ if [ ! -b /dev/${DISK} ]; then
+ eerror "Could not find disk /dev/${DISK}!"
+ eerror "Adjust the DISK setting in /etc/conf.d/hdapsd"
+ return 1
+ fi
+
+ if [[ ! -e /sys/block/${DISK}/queue/protect ]] && [[ ! -e /sys/block/${DISK}/device/unload_heads ]] ; then
+ eerror "No protect entry for ${DISK}!"
+ eerror "Make sure your kernel is patched with the blk_freeze patch"
+ return 1
+ fi
+ done
+
+ # Load the tp_smapi module first
+ # This is not a requirement, but it helps hdapsd adaptive mode
+ if [[ ! -e /sys/devices/platform/smapi ]] ; then
+ modprobe tp_smapi 2>/dev/null
+ fi
+
+ if [[ ! -d /sys/devices/platform/hdaps ]]; then
+ ebegin "Loading hdaps module"
+ modprobe hdaps
+ eend $? || return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ local DISKOPTS DISK
+ for DISK in ${DISKLIST}; do
+ DISKOPTS="-d ${DISK} "
+ done
+
+ ebegin "Starting Hard Drive Active Protection System daemon"
+ start-stop-daemon --start --exec /usr/sbin/hdapsd \
+ --pidfile /var/run/hdapsd.pid \
+ -- --syslog --background --pidfile \
+ ${DISKOPTS} --sensitivity "${THRESHOLD}" ${OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Hard Drive Active Protection System daemon"
+ start-stop-daemon --stop --exec /usr/sbin/hdapsd \
+ --pidfile /var/run/hdapsd.pid
+ eend $?
+}
diff --git a/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild b/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild
new file mode 100644
index 000000000000..d4774ceac80e
--- /dev/null
+++ b/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild,v 1.1 2011/12/21 04:51:22 ottxor Exp $
+
+EAPI=4
+inherit linux-info
+
+DESCRIPTION="IBM ThinkPad Harddrive Active Protection disk head parking daemon"
+HOMEPAGE="http://hdaps.sourceforge.net/"
+SRC_URI="mirror://sourceforge/hdaps/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+pkg_setup() {
+ # We require the hdaps module which can either come from kernel sources or
+ # from the tp_smapi package.
+ if ! has_version app-laptop/tp_smapi[hdaps]; then
+ CONFIG_CHECK="~SENSORS_HDAPS"
+ ERROR_SENSORS_HDAPS="${P} requires app-laptop/tp_smapi (with hdaps USE enabled) or support for CONFIG_SENSORS_HDAPS enabled"
+ linux-info_pkg_setup
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${ED}" install
+ rm -rf "${ED}"/usr/share/doc/hdapsd
+ dodoc ChangeLog README AUTHORS
+ newconfd "${FILESDIR}"/hdapsd.conf.2 hdapsd
+ newinitd "${FILESDIR}"/hdapsd.init.2 hdapsd
+}
+
+pkg_postinst(){
+ [[ -z $(ls ${EROOT}/sys/block/*/queue/protect 2>/dev/null) ]] && \
+ [[ -z $(ls ${EROOT}/sys/block/*/device/unload_heads 2>/dev/null) ]] && \
+ ewarn "Your kernel does NOT support shock protection. Kernel 2.6.28 and above is recommended!"
+
+ if ! has_version app-laptop/tp_smapi[hdaps]; then
+ ewarn "Using the hdaps module provided by app-laptop/tp_smapi instead"
+ ewarn "of the in-kernel driver is strongly recommended!"
+ fi
+
+ elog "You can change the default frequency by modifing /sys/devices/platform/hdaps/sampling_rate"
+ elog "You might need to enable shock protection manually by running "
+ elog " echo -1 > /sys/block/DEVICE/device/unload_heads"
+}