From f32479c4ab20b9aeea3b9e0f691b29a8d5970b0e Mon Sep 17 00:00:00 2001 From: Omar Vega Ramos Date: Sun, 5 Mar 2017 12:21:01 -0500 Subject: pm-utils: add new package to [pcr] --- pcr/pm-utils/02-logging-append.patch | 19 +++++++ .../12-fix-intel-audio-powersave-hook.patch | 40 ++++++++++++++ pcr/pm-utils/13-49bluetooth-sync.patch | 43 +++++++++++++++ pcr/pm-utils/14-disable-sata-alpm.patch | 26 +++++++++ pcr/pm-utils/PKGBUILD | 63 ++++++++++++++++++++++ 5 files changed, 191 insertions(+) create mode 100644 pcr/pm-utils/02-logging-append.patch create mode 100644 pcr/pm-utils/12-fix-intel-audio-powersave-hook.patch create mode 100644 pcr/pm-utils/13-49bluetooth-sync.patch create mode 100644 pcr/pm-utils/14-disable-sata-alpm.patch create mode 100644 pcr/pm-utils/PKGBUILD diff --git a/pcr/pm-utils/02-logging-append.patch b/pcr/pm-utils/02-logging-append.patch new file mode 100644 index 000000000..987e0570a --- /dev/null +++ b/pcr/pm-utils/02-logging-append.patch @@ -0,0 +1,19 @@ +Author: James Westby +Description: Do not clear the log file on each operation, but instead append to it. + This makes debugging of several suspends much easier. +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=25255 +Bug-Ubuntu: https://launchpad.net/bugs/410352 + +Index: pm-utils/pm/pm-functions.in +=================================================================== +--- pm-utils.orig/pm/pm-functions.in 2010-07-05 18:41:21.118322244 +0200 ++++ pm-utils/pm/pm-functions.in 2010-07-05 18:41:24.126325221 +0200 +@@ -271,7 +271,7 @@ + return 1 + fi + export LOGGING=true +- exec > "$1" 2>&1 ++ exec >> "$1" 2>&1 + } + + check_suspend() { [ -n "$SUSPEND_MODULE" ]; } diff --git a/pcr/pm-utils/12-fix-intel-audio-powersave-hook.patch b/pcr/pm-utils/12-fix-intel-audio-powersave-hook.patch new file mode 100644 index 000000000..2d884da1e --- /dev/null +++ b/pcr/pm-utils/12-fix-intel-audio-powersave-hook.patch @@ -0,0 +1,40 @@ +From: Florian Kriener +To: submit@bugs.debian.org +Subject: [pm-utils] wrong path in intel-audio-powersave (and a small bug) +Date: Sat, 25 Sep 2010 11:27:30 +0200 + +In the script intel-audio-powersave is this loop + +for dev in /sys/module/snd_*/parameters/power_save; do + [ -w "$dev/parameters/power_save" ] || continue + printf "Setting power savings for $s to %d..." "$dev##*/" "$1" + echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed. +done + +I think it should be + +for dev in /sys/module/snd_*; do + [ -w "$dev/parameters/power_save" ] || continue + printf "Setting power savings for %s to %d..." "${dev##*/}" "$1" + echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed. +done + + +This fixes the two bugs. + +diff --git a/pm/power.d/intel-audio-powersave b/pm/power.d/intel-audio-powersave +index 36675a8..da63e40 100644 +--- a/pm/power.d/intel-audio-powersave ++++ b/pm/power.d/intel-audio-powersave +@@ -20,9 +20,9 @@ EOF + + audio_powersave() { + [ "$INTEL_AUDIO_POWERSAVE" = "true" ] || exit $NA +- for dev in /sys/module/snd_*/parameters/power_save; do ++ for dev in /sys/module/snd_*; do + [ -w "$dev/parameters/power_save" ] || continue +- printf "Setting power savings for $s to %d..." "$dev##*/" "$1" ++ printf "Setting power savings for %s to %d..." "${dev##*/}" "$1" + echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed. + done + } diff --git a/pcr/pm-utils/13-49bluetooth-sync.patch b/pcr/pm-utils/13-49bluetooth-sync.patch new file mode 100644 index 000000000..b41f32cf9 --- /dev/null +++ b/pcr/pm-utils/13-49bluetooth-sync.patch @@ -0,0 +1,43 @@ +From 640b53438c20818b3e344343b58b1f1765606a85 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Mon, 31 Jan 2011 15:30:01 +0100 +Subject: [PATCH] 49bluetooth: Wait for btusb module to get unused + +The 49bluetooth hook disables /proc/acpi/ibm/bluetooth but this isn't +synchronous, i. e. it doesn't wait until the module usage count actually drops +to 0. Due to that, it's impossible to add btusb to SUSPEND_MODULES (on some +models/older kernels you need to do that to fix suspend problems), as at that +point the module is still in use. + +On my system (ThinkPad X201) the module takes between 0.3 and 0.5 seconds to +unload, so use 100 ms wait steps with a timeout of 2 seconds. + +Bug: https://bugs.freedesktop.org//show_bug.cgi?id=33759 +Bug-Ubuntu: https://launchpad.net/bugs/698331 +--- + pm/sleep.d/49bluetooth | 9 +++++++++ + 1 files changed, 9 insertions(+), 0 deletions(-) + +diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth +index d46ba49..0dc1909 100755 +--- a/pm/sleep.d/49bluetooth ++++ b/pm/sleep.d/49bluetooth +@@ -12,6 +12,15 @@ suspend_bluetooth() + if grep -q enabled /proc/acpi/ibm/bluetooth; then + savestate ibm_bluetooth enable + echo disable > /proc/acpi/ibm/bluetooth ++ ++ # wait for up to 2 seconds for the module to actually get ++ # unused ++ TIMEOUT=20 ++ while [ $TIMEOUT -ge 0 ]; do ++ [ `cat /sys/module/btusb/refcnt` = 0 ] && break ++ TIMEOUT=$((TIMEOUT-1)) ++ sleep 0.1 ++ done + else + savestate ibm_bluetooth disable + fi +-- +1.7.2.3 + diff --git a/pcr/pm-utils/14-disable-sata-alpm.patch b/pcr/pm-utils/14-disable-sata-alpm.patch new file mode 100644 index 000000000..7b5494932 --- /dev/null +++ b/pcr/pm-utils/14-disable-sata-alpm.patch @@ -0,0 +1,26 @@ +Description: Disable SATA link power management by default, as it still causes disk errors and corruptions on many hardware. +Author: Martin Pitt +Bug-Ubuntu: https://launchpad.net/bugs/539467 + +Index: pm-utils/pm/power.d/sata_alpm +=================================================================== +--- pm-utils.orig/pm/power.d/sata_alpm 2011-02-01 15:53:09.164867778 +0100 ++++ pm-utils/pm/power.d/sata_alpm 2011-02-01 15:53:28.954867786 +0100 +@@ -2,7 +2,7 @@ + + . "${PM_FUNCTIONS}" + +-SATA_ALPM_ENABLE=${SATA_ALPM_ENABLE:-true} ++SATA_ALPM_ENABLE=${SATA_ALPM_ENABLE:-false} + + help() { + cat < +# Contributor (Manjaro): Jan de Groot +# Contributor (Manjaro): Thayer Williams +# Contributor (Manjaro): Giovanni Scafora +# Maintainer: Omar Vega Ramos + +_date=20100619 +_extra=pm-quirks + +pkgname=pm-utils +pkgver=1.4.1 +pkgrel=7 +pkgdesc="Utilities and scripts for suspend and hibernate power management" +arch=('i686' 'x86_64' 'armv7h') +url="http://pm-utils.freedesktop.org" +license=('GPL') +depends=('bash' 'procps') +conflicts=('pm-quirks') +replaces=('pm-quirks') +makedepends=('xmlto' 'docbook-xml' 'docbook-xsl') +source=("http://pm-utils.freedesktop.org/releases/${pkgname}-${pkgver}.tar.gz" + '02-logging-append.patch' + '12-fix-intel-audio-powersave-hook.patch' + '13-49bluetooth-sync.patch' + '14-disable-sata-alpm.patch' + "http://pm-utils.freedesktop.org/releases/${_extra}-${_date}.tar.gz") +sha256sums=('8ed899032866d88b2933a1d34cc75e8ae42dcde20e1cc21836baaae3d4370c0b' + '5622a42167a5f6b725ecbe473d8f0994c4b3ac32e5c6607ce1fab0888894f139' + '16d5355d1c5cff6316fef11768673434394582c67039c79e8b86aafe2d2f7797' + '2af763812d609f384c818635028791c875e3e56a1fa387e80b7f1ca5afc3c4e3' + 'c995912f25fd1f0c30c90136c36ac49e2d3a5fdb94ef1710a7e0426dd10dad8a' + '14a50518928c27417cdc8bcbabb32b3d986931de105149aa248d8883e56c61ec') + +prepare(){ + cd "${srcdir}/${pkgname}-${pkgver}" + patch -Np1 -i "${srcdir}/02-logging-append.patch" + patch -Np1 -i "${srcdir}/12-fix-intel-audio-powersave-hook.patch" + patch -Np1 -i "${srcdir}/13-49bluetooth-sync.patch" + patch -Np1 -i "${srcdir}/14-disable-sata-alpm.patch" +} + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --sbindir=/usr/bin \ + --localstatedir=/var + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install + + # nm >=0.8.2 has native udev suspend/resume support + rm -f "${pkgdir}/usr/lib/pm-utils/sleep.d/55NetworkManager" + + # Remove hooks that cause hardware failure or don't make sense at all + rm -f "${pkgdir}/usr/lib/pm-utils/power.d/"{harddrive,disable_wol} + + install -m755 -d "${pkgdir}/usr/lib/pm-utils/video-quirks" + install -m644 ${srcdir}/video-quirks/*.quirkdb "${pkgdir}/usr/lib/pm-utils/video-quirks/" +} -- cgit v1.2.3