Hello community, here is the log from the commit of package pm-utils for openSUSE:Factory checked in at Sat Apr 3 00:16:46 CEST 2010. -------- --- pm-utils/pm-utils.changes 2010-02-16 16:18:50.000000000 +0100 +++ /mounts/work_src_done/STABLE/pm-utils/pm-utils.changes 2010-04-02 10:47:16.000000000 +0200 @@ -1,0 +2,14 @@ +Fri Apr 2 08:45:12 UTC 2010 - mvyskocil@suse.cz + +- Updated to 1.3.0: fix bnc#590709 + * pm-utils does not depends on HAL anymore + * import HAL's fdi quirks + * track whether suspend/hibernate succeeded, and handle things as appropriately as we can. + * Native suspend-hybrid method. + * Profile the entire suspend/resume process using PM_PROFILE. +- backport the existing patches, split and sort them +- remove the HAL dependencies from power.d hooks wol and sata-pm +- use explicit dependencies on external tools +- powersave is back - now partially supports upower + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- pm-utils-1.2.6.1-grub.patch pm-utils-1.2.6.1-logging.patch pm-utils-1.2.6.1-on_ac_power-no-dbus-fallback.diff pm-utils-1.2.6.1-smart-uswsusp.patch pm-utils-1.2.6.1.tar.bz2 pm-utils-suse-73f6e713970bff833abf162fd8515e9aaf75cd17.tar.bz2 New: ---- pm-quirks-20100316.tar.bz2 pm-utils-1.3.0-on_ac_power-no-dbus-fallback.diff pm-utils-1.3.0-suse-config.patch pm-utils-1.3.0-suse-drop-import-fdi-quirkdb.patch pm-utils-1.3.0-suse-grub.patch pm-utils-1.3.0-suse-logging.patch pm-utils-1.3.0-suse-smart-uswsusp.patch pm-utils-1.3.0-upower.patch pm-utils-1.3.0.tar.bz2 pm-utils-suse-e0959e450acdef4457208c85692d354118ed2dcf.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pm-utils.spec ++++++ --- /var/tmp/diff_new_pack.vV3APe/_old 2010-04-03 00:15:36.000000000 +0200 +++ /var/tmp/diff_new_pack.vV3APe/_new 2010-04-03 00:15:36.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package pm-utils (Version 1.2.6.1) +# spec file for package pm-utils (Version 1.3.0) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -18,30 +18,56 @@ # norootforbuild %define pm_libdir %{_prefix}/lib/%{name}/ +%define pm_quirkdbdir %{pm_libdir}/video-quirks %define pm_sysconfdir %{_sysconfdir}/pm/config.d/ Name: pm-utils -Version: 1.2.6.1 -Release: 2 +Version: 1.3.0 +Release: 1 Summary: Tools to suspend and hibernate computers License: GPLv2+ Group: System/Base Url: http://pm-utils.freedesktop.org/wiki/ Source: %{name}-%{version}.tar.bz2 +# PATCH-FIX-UPSTREAM: upower suport +# http://www.mail-archive.com/pm-utils@lists.freedesktop.org/msg02018.html +# http://cgit.freedesktop.org/pm-utils/commit/?id=e8d0b58a9df080f021d04b4c2d35... +Patch0: pm-utils-1.3.0-upower.patch #PATCH-FIX-OPENSUSE: on_ac_power don't produce veird errors if HAL or D-BUS are broken -Patch1: pm-utils-1.2.6.1-on_ac_power-no-dbus-fallback.diff -#PATCH-FIX-OPENSUSE: backport the smarter swsusp to 1.2.6.1 -Patch2: pm-utils-1.2.6.1-smart-uswsusp.patch +Patch1: pm-utils-1.3.0-on_ac_power-no-dbus-fallback.diff #PATCH-FIX-OPENSUSE: fixes a dbus-send call -Patch3: pm-utils-1.2.6.1-fix-broken-dbus-send.diff +Patch2: pm-utils-1.2.6.1-fix-broken-dbus-send.diff +#PATCH-FIX-OPENSUSE: make the uswsusp module default on SUSE and port the "smart" behavior +Patch3: pm-utils-1.3.0-suse-smart-uswsusp.patch +#PATCH-FIX-OPENSUSE: add some aditional config variables for pm-utils-suse +Patch4: pm-utils-1.3.0-suse-config.patch #PATCH-FIX-OPENSUSE: more SUSE friendly grub handler -Patch4: pm-utils-1.2.6.1-grub.patch +Patch5: pm-utils-1.3.0-suse-grub.patch #PATCH-FIX-OPENSUSE: setup also kernel loglevel to show up the progress bar -Patch5: pm-utils-1.2.6.1-logging.patch +Patch6: pm-utils-1.3.0-suse-logging.patch +#PATCH-FIX-OPENSUSE: drop import-fdi-quirkdb from installation, SUSE has it included +#Note: it will be removed in next release, no needed to ustream +Patch7: pm-utils-1.3.0-suse-drop-import-fdi-quirkdb.patch # http://gitorious.org/opensuse/pm-utils-suse -Source1: pm-utils-suse-73f6e713970bff833abf162fd8515e9aaf75cd17.tar.bz2 +Source1: pm-utils-suse-e0959e450acdef4457208c85692d354118ed2dcf.tar.bz2 +Source2: http://pm-utils.freedesktop.org/releases/pm-quirks-20100316.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires: hal + +# hooks requires some external tools +Requires: grep +Requires: sed +Requires: ethtool +Requires: gawk +Requires: coreutils +Requires: module-init-tools + +%if 0%{?suse_version} <= 1120 +Requires: DeviceKit-disks +Requires: DeviceKit-power +%else +Requires: udisks +Requires: upower +%endif %description pm-utils provide simple shell command line tools to suspend and @@ -71,12 +97,15 @@ %prep -%setup -q -b 1 +%setup -q -b 1 -a 2 +%patch0 -p1 -b .upower %patch1 -p1 -b .no-dbus-fallback -%patch2 -p1 -b .smart-swsusp -%patch3 -p1 -b .broken-dbus -%patch4 -p1 -b .grub -%patch5 -p1 -b .logging +%patch2 -p1 -b .broken-dbus +%patch3 -p1 -b .smart-swsusp +%patch4 -p1 -b .suse-config +%patch5 -p1 -b .suse-grub +%patch6 -p1 -b .suse-logging +%patch7 -p1 -b .drop-import-fdi-quirkdb %build %{configure} \ @@ -89,11 +118,16 @@ #FIXME: should be installed by make install %{__install} -m 644 man/*.1 %{buildroot}/%{_mandir}/man1 %{__install} -m 644 man/*.8 %{buildroot}/%{_mandir}/man8 +#quirks +%{__install} -d -m 0755 %{buildroot}%{pm_quirkdbdir} +%{__install} -m 0644 *.quirkdb %{buildroot}%{pm_quirkdbdir} #SUSE hooks pushd ../pm-utils-suse %{__install} -m 0755 hooks/sleep.d/* %{buildroot}/%{pm_libdir}/sleep.d/ %{__install} -m 0755 hooks/power.d/* %{buildroot}/%{pm_libdir}/power.d/ %{__install} -m 0644 hooks/config.d/* %{buildroot}/%{pm_sysconfdir}/ +# powersave command is back +%{__install} -m 0755 bin/powersave %{buildroot}/%{_bindir} popd %{__install} -d -m 0755 %{buildroot}/%{_localstatedir}/log touch %{buildroot}/%{_localstatedir}/log/pm-suspend.log @@ -109,7 +143,7 @@ %files %defattr (-,root,root) %doc README ChangeLog AUTHORS ../pm-utils-suse/doc/README.smart-suspend-to-RAM -%{_bindir}/* +%attr(0755,root,root) %{_bindir}/* %{_sbindir}/* %{_sysconfdir}/pm/ %config(noreplace) %{_sysconfdir}/pm/config.d/rtcwake.config ++++++ pm-utils-1.2.6.1-on_ac_power-no-dbus-fallback.diff -> pm-utils-1.3.0-on_ac_power-no-dbus-fallback.diff ++++++ --- pm-utils/pm-utils-1.2.6.1-on_ac_power-no-dbus-fallback.diff 2009-11-25 13:44:50.000000000 +0100 +++ /mounts/work_src_done/STABLE/pm-utils/pm-utils-1.3.0-on_ac_power-no-dbus-fallback.diff 2010-04-01 16:44:43.000000000 +0200 @@ -1,9 +1,25 @@ -Index: pm-utils-1.2.6.1/src/on_ac_power +Index: pm-utils-1.3.0/src/on_ac_power =================================================================== ---- pm-utils-1.2.6.1.orig/src/on_ac_power 2009-06-14 03:56:09.000000000 +0200 -+++ pm-utils-1.2.6.1/src/on_ac_power 2009-11-19 12:38:03.213061128 +0100 -@@ -31,17 +31,28 @@ - # +--- pm-utils-1.3.0.orig/src/on_ac_power 2010-04-01 12:07:44.679844425 +0200 ++++ pm-utils-1.3.0/src/on_ac_power 2010-04-01 12:09:45.631532099 +0200 +@@ -35,7 +35,7 @@ + --dest=org.freedesktop.UPower \ + /org/freedesktop/UPower \ + org.freedesktop.DBus.Properties.Get \ +- string:org.freedesktop.UPower string:OnBattery)"; then ++ string:org.freedesktop.UPower string:OnBattery 2>/dev/null)"; then + echo "$s" | grep -q 'boolean false' + exit $? + fi +@@ -45,23 +45,34 @@ + --dest=org.freedesktop.DeviceKit.Power \ + /org/freedesktop/DeviceKit/Power \ + org.freedesktop.DBus.Properties.Get \ +- string:org.freedesktop.DeviceKit.Power string:OnBattery)"; then ++ string:org.freedesktop.DeviceKit.Power string:OnBattery 2>/dev/null)"; then + echo "$s" | grep -q 'boolean false' + exit $? + fi # Check for AC/DC/etc adapters -ac_adapters="$(hal-find-by-capability --capability ac_adapter)" @@ -25,7 +41,7 @@ -done + # If any of them are online, then we're done. + for device in $ac_adapters ; do -+ present=$(hal-get-property --udi $device --key ac_adapter.present) ++ present="$(hal-get-property --udi "$device" --key ac_adapter.present 2>/dev/null)" + [ "$present" == "true" ] && exit 0 + done +else # fall back to /sys/.../ac/... parsing... ++++++ pm-utils-1.3.0-suse-config.patch ++++++ --- pm/defaults | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) Index: pm-utils-1.3.0/pm/defaults =================================================================== --- pm-utils-1.3.0.orig/pm/defaults 2010-04-01 12:12:38.903407733 +0200 +++ pm-utils-1.3.0/pm/defaults 2010-04-01 12:33:01.706869112 +0200 @@ -46,6 +46,25 @@ # if S2RAM_OPTS is set, it overrides S2RAM_QUIRKS_SOURCE! S2RAM_QUIRKS_SOURCE="" +# IWL power management +# 6: Radio always on, default AC +# 1-5: BATTERY levels, the higher the value, the more power is saved +# Empty string is meant for not touching any power management features at all +IWL_PM="5" + +# SATA power management +# Possible values are: min_power, medium_power, max_performance +# Empty string is meant for not touching any power management features at all +SATA_PM="medium_power" + +# SOUND power management +# Specifies the timeout after a sound card enters a low power mode +# Empty string is meant for not touching any power management features at all +SOUND_PM="10" + +# the location of the autogenerated s2disk (s2both) config file +S2DISK_CONF="/var/lib/s2disk.conf" + ####################################################################### # These variables will be handled specially when we load files in # /etc/pm/config.d. ++++++ pm-utils-1.3.0-suse-drop-import-fdi-quirkdb.patch ++++++ --- src/Makefile.am | 2 +- src/Makefile.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: pm-utils-1.3.0/src/Makefile.am =================================================================== --- pm-utils-1.3.0.orig/src/Makefile.am 2009-12-25 17:41:57.000000000 +0100 +++ pm-utils-1.3.0/src/Makefile.am 2010-04-01 13:39:26.508515181 +0200 @@ -18,7 +18,7 @@ sbin_SCRIPTS = pm-powersave -script_in_files = pm-action.in pm-is-supported.in pm-powersave.in import-fdi-quirkdb.in +script_in_files = pm-action.in pm-is-supported.in pm-powersave.in CLEANFILES = $(script_in_files:.in=) Index: pm-utils-1.3.0/src/Makefile.in =================================================================== --- pm-utils-1.3.0.orig/src/Makefile.in 2010-03-17 04:20:32.000000000 +0100 +++ pm-utils-1.3.0/src/Makefile.in 2010-04-01 13:39:53.423407178 +0200 @@ -187,9 +187,9 @@ pm_reset_swap_SOURCES = pm-reset-swap.c pm_bin_SCRIPTS = pm-action bin_SCRIPTS = pm-is-supported -dist_bin_SCRIPTS = on_ac_power import-fdi-quirkdb +dist_bin_SCRIPTS = on_ac_power sbin_SCRIPTS = pm-powersave -script_in_files = pm-action.in pm-is-supported.in pm-powersave.in import-fdi-quirkdb.in +script_in_files = pm-action.in pm-is-supported.in pm-powersave.in CLEANFILES = $(script_in_files:.in=) EXTRA_DIST = $(script_in_files) do_subst = sed -e 's,[@]PM-UTILS-LIBDIR[@],$(pm_libdir),g' \ ++++++ pm-utils-1.3.0-suse-grub.patch ++++++ Index: pm-utils-1.3.0/pm/sleep.d/01grub =================================================================== --- pm-utils-1.3.0.orig/pm/sleep.d/01grub 2010-03-30 13:01:02.069674802 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -#!/bin/sh -# Ensure grub will load the correct kernel on resume from hibernate, -# TODO: This is rather redhat specific, and very grub specific. - -default_resume_kernel() -{ - [ "$1" = "suspend" ] && return $NA - case $(uname -m) in - i?86|x86_64|athlon) - ;; - *) # this is only valid for x86 and x86_64 - return $NA - ;; - esac - - [ -x /sbin/grubby -a -x /sbin/grub ] || return $NA - [ -e "/boot/vmlinuz-$(uname -r)" ] || return 1 - out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index) - [ -n "${out}" ] || return 1 - current=${out#index=} - echo "savedefault --default=${current} --once" | \ - /sbin/grub --device-map=/boot/grub/device.map \ - --batch --no-floppy --no-curses >/dev/null - - return 0 -} - -case "$1" in - hibernate|suspend) - default_resume_kernel $2 - ;; - *) exit $NA - ;; -esac Index: pm-utils-1.3.0/pm/sleep.d/99Zgrub =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ pm-utils-1.3.0/pm/sleep.d/99Zgrub 2010-03-30 13:01:16.839798542 +0200 @@ -0,0 +1,193 @@ +#!/bin/bash +# +# Stefan Seyfried, SUSE Linux Products GmbH 2006, GPL v2 +# mostly taken from the powersave project. + +GRUBONCE="/usr/sbin/grubonce" +GRUBDEFAULT="/boot/grub/default" +GRUBDEFSAVE="/var/run/suspend.grubonce.default" + +##################################################################### +# gets a list of available kernels from /boot/grub/menu.lst +# kernels are in the array $KERNELS, output to stdout to be eval-ed. +getkernels() +{ + # DEBUG "Running getkernels()" INFO + local MENU_LST="/boot/grub/menu.lst" + local I DUMMY MNT ROOTDEV + declare -i I=0 J=-1 + + # we need the root partition later to decide if this is the kernel to select + while read ROOTDEV MNT DUMMY; do + [ "$ROOTDEV" = "rootfs" ] && continue # not what we are searching for + if [ "$MNT" = "/" ]; then + break + fi + done < /proc/mounts + + # build an array KERNELS with all the kernels in /boot/grub/menu.lst + # the array MENU_ENTRIES contains the corresponding menu entry numbers + # DEFAULT_BOOT contains the default entry. + while read LINE; do + case $LINE in + title*) + let J++ # increase for every menu entry, even for non-linux + # DEBUG "Found grub menu entry #${J}: '${LINE}'" INFO + ;; + default*) + DUMMY=($LINE) # "default 0 #maybe a comment" + echo "DEFAULT_BOOT=${DUMMY[1]}" # ^^[0]^^ 1 ^^[2]^ 3 ^^[4]^^ + # DEBUG "Default boot entry is '${DUMMY[1]}'" INFO + ;; + kernel*noresume*) + # we probably found the "failsafe" kernel that won't resume... + echo " Skipping grub entry #${J}, because it has the noresume option" >&2 + ;; + kernel*root=*) + local ROOT + ROOT=${LINE#*root=} + DUMMY=($ROOT) + ROOT=${DUMMY[0]} + if [ "$(stat -Lc '%t:%T' $ROOT)" != "$(stat -Lc '%t:%T' $ROOTDEV)" ]; then + echo " Skipping grub entry #${J}, because its root= parameter ($ROOT)" >&2 + echo " does not match the current root device ($ROOTDEV)." >&2 + continue + fi + DUMMY=($LINE) # kernel (hd0,1)/boot/vmlinuz-ABC root=/dev/hda2 + echo "KERNELS[$I]='${DUMMY[1]##*/}'" # vmlinuz-ABC + echo "MENU_ENTRIES[$I]=$J" + # DEBUG "Found kernel entry #${I}: '${DUMMY[1]##*/}'" INFO + let I++ + ;; + kernel*) + # a kernel without "root="? We better skip that one... + echo " Skipping grub entry #${J}, because it has no root= option" >&2 + ;; + *) ;; + esac + done < $MENU_LST +} + +############################################################# +# runs grubonce from the grub package to select which kernel +# to boot on next startup +grub-once() +{ + if [ -x "$GRUBONCE" ]; then + rm -f "$GRUBDEFSAVE" + if [ -e "$GRUBDEFAULT" ]; then + echo " saving original $GRUBDEFAULT" + cp "$GRUBDEFAULT" "$GRUBDEFSAVE" + fi + echo " running '$GRUBONCE $1'" + $GRUBONCE $1 + else + echo "WARNING: $GRUBONCE not found, not preparing bootloader" + fi +} + +############################################################# +# restore grub default after (eventually failed) resume +grub-once-restore() +{ + echo "INFO: running grub-once-restore" + rm -f "$GRUBDEFAULT" + if [ -e "$GRUBDEFSAVE" ]; then + echo " restoring original $GRUBDEFAULT" + mv "$GRUBDEFSAVE" "$GRUBDEFAULT" + fi +} + +############################################################################# +# try to find a kernel image that matches the actually running kernel. +# We need this, if more than one kernel is installed. This works reasonably +# well with grub, if all kernels are named "vmlinuz-`uname -r`" and are +# located in /boot. If they are not, good luck ;-) +find-kernel-entry() +{ + NEXT_BOOT=-1 + ARCH=`uname -m` + declare -i I=0 + # DEBUG "running kernel: $RUNNING" DIAG + while [ -n "${KERNELS[$I]}" ]; do + BOOTING="${KERNELS[$I]}" + if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then + # DEBUG "Found kernel symlink $BOOTING => $IMAGE" INFO + BOOTING=$IMAGE + fi + case $ARCH in + ppc*) BOOTING="${BOOTING#*vmlinux-}" ;; + *) BOOTING="${BOOTING#*vmlinuz-}" ;; + esac + if [ "$RUNNING" == "$BOOTING" ]; then + NEXT_BOOT=${MENU_ENTRIES[$I]} + echo " running kernel is grub menu entry $NEXT_BOOT (${KERNELS[$I]})" + break + fi + let I++ + done + # if we have not found a kernel, issue a warning. + # if we have found a kernel, we'll do "grub-once" later, after + # prepare_suspend finished. + if [ $NEXT_BOOT -eq -1 ]; then + echo "WARNING: no kernelfile matching the running kernel found" + fi +} + +############################################################################# +# if we did not find a kernel (or BOOT_LOADER is not GRUB) check, +# if the running kernel is still the one that will (probably) be booted for +# resume (default entry in menu.lst or, if there is none, the kernel file +# /boot/vmlinuz points to.) +# This will only work, if you use "original" SUSE kernels. +# you can always override with the config variable set to "yes" +prepare-grub() +{ + echo "INFO: running prepare-grub" + eval `getkernels` + RUNNING=`uname -r` + find-kernel-entry + + RET=0 + + if [ $NEXT_BOOT -eq -1 ]; then + # which kernel is booted with the default entry? + BOOTING="${KERNELS[$DEFAULT_BOOT]}" + # if there is no default entry (no menu.lst?) we fall back to + # the default of /boot/vmlinuz. + [ -z "$BOOTING" ] && BOOTING="vmlinuz" + if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then + BOOTING=$IMAGE + fi + BOOTING="${BOOTING#*vmlinuz-}" + echo "running kernel: '$RUNNING', probably booting kernel: '$BOOTING'" + if [ "$BOOTING" != "$RUNNING" ]; then + echo "ERROR: kernel version mismatch, cannot suspend to disk" + echo "running: $RUNNING booting: $BOOTING" >> $INHIBIT + RET=1 + fi + else + # set the bootloader to the running kernel + echo " preparing boot-loader: selecting entry $NEXT_BOOT, kernel /boot/$BOOTING" + T1=`date +"%s%N"` + sync; sync; sync # this is needed to speed up grub-once on reiserfs + T2=`date +"%s%N"` + echo " grub-once: `grub-once $NEXT_BOOT`" + T3=`date +"%s%N"` + S=$(((T2-T1)/100000000)); S="$((S/10)).${S:0-1}" + G=$(((T3-T2)/100000000)); G="$((G/10)).${G:0-1}" + echo " time needed for sync: $S seconds, time needed for grub: $G seconds." + fi + + return $RET +} + + +###### main() + +if [ "$1" = hibernate ] || [ "$1" = suspend -a "$2" = suspend_hybrid ]; then + prepare-grub +fi +if [ "$1" = thaw ] || [ "$1" = resume -a "$2" = suspend_hybrid ]; then + grub-once-restore +fi Index: pm-utils-1.3.0/pm/sleep.d/Makefile.am =================================================================== --- pm-utils-1.3.0.orig/pm/sleep.d/Makefile.am 2010-03-30 13:01:02.069674802 +0200 +++ pm-utils-1.3.0/pm/sleep.d/Makefile.am 2010-03-30 13:01:16.839798542 +0200 @@ -3,7 +3,7 @@ sleep_SCRIPTS = \ 00logging \ 00powersave \ - 01grub \ + 99Zgrub \ 49bluetooth \ 55NetworkManager \ 75modules \ Index: pm-utils-1.3.0/pm/sleep.d/Makefile.in =================================================================== --- pm-utils-1.3.0.orig/pm/sleep.d/Makefile.in 2010-03-30 13:01:02.069674802 +0200 +++ pm-utils-1.3.0/pm/sleep.d/Makefile.in 2010-03-30 13:01:16.904797911 +0200 @@ -161,7 +161,7 @@ sleep_SCRIPTS = \ 00logging \ 00powersave \ - 01grub \ + 99Zgrub \ 49bluetooth \ 55NetworkManager \ 75modules \ ++++++ pm-utils-1.3.0-suse-logging.patch ++++++ Index: pm-utils-1.2.6.1/pm/sleep.d/00logging =================================================================== --- pm-utils-1.2.6.1.orig/pm/sleep.d/00logging 2009-06-14 03:56:09.000000000 +0200 +++ pm-utils-1.2.6.1/pm/sleep.d/00logging 2009-11-24 09:01:10.010044035 +0100 @@ -1,14 +1,33 @@ #!/bin/sh # Log some extra information at the beginning of a suspend/resume cycle. # TODO: Make this hook only run when PM_DEBUG is true? +# SUSE: setup also kernel loglevel to show a progress bar . "${PM_FUNCTIONS}" case "$1" in hibernate|suspend) [ -n "$PM_LOGFILE" ] || exit 0 - /bin/uname -a - lsmod - free + # save the old loglevel + read KERNEL_LOGLEVEL DUMMY < /proc/sys/kernel/printk + echo "export KERNEL_LOGLEVEL=$KERNEL_LOGLEVEL" >> /var/run/pm-suspend + # set the loglevel so we see the progress bar. + # if the level is higher than needed, we leave it alone. + if [ $KERNEL_LOGLEVEL -lt 5 ]; then + echo 5 > /proc/sys/kernel/printk + fi + echo "$1 initiated: `date`" + echo + echo "`/bin/uname -a`" + echo "kernel command line: '`cat /proc/cmdline`'" + echo "`lsmod`" + echo + echo "`free`" + echo + ;; + thaw|resume) + if [ -n "$KERNEL_LOGLEVEL" ] ; then + echo $KERNEL_LOGLEVEL > /proc/sys/kernel/printk + fi ;; esac ++++++ pm-utils-1.3.0-suse-smart-uswsusp.patch ++++++ --- pm/defaults | 20 +++++++++++++++- pm/module.d/uswsusp | 63 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 77 insertions(+), 6 deletions(-) Index: pm-utils-1.3.0/pm/defaults =================================================================== --- pm-utils-1.3.0.orig/pm/defaults 2010-04-01 12:07:40.378407398 +0200 +++ pm-utils-1.3.0/pm/defaults 2010-04-01 12:12:38.903407733 +0200 @@ -27,8 +27,26 @@ # tuxonice If your system has support for tuxonice, use this. # # The system defaults to "kernel" if this is commented out. -# SLEEP_MODULE="kernel" +SLEEP_MODULE="uswsusp" +####################################################################### +# the variables below here are specific to the SUSE package right now +# and are used only if SLEEP_MODULE is uswsusp + +# what options should be passed to s2ram? +# see http://en.opensuse.org/S2ram for more information +# If this option is set, it overrides S2RAM_QUIRKS_SOURCE below +S2RAM_OPTS="" + +# where should pm-utils get the s2ram quirks from? +# s2ram - use the whitelist in s2ram, if the machine is known. +# hal - ignored, exists only for comparibility purposes pm-utils 1.3.0+ has +# HAL quirks built-in +# everything else: try to be smart in figuring out the correct quirks. +# if S2RAM_OPTS is set, it overrides S2RAM_QUIRKS_SOURCE! +S2RAM_QUIRKS_SOURCE="" + +####################################################################### # These variables will be handled specially when we load files in # /etc/pm/config.d. # Multiple declarations of these environment variables will result in Index: pm-utils-1.3.0/pm/module.d/uswsusp =================================================================== --- pm-utils-1.3.0.orig/pm/module.d/uswsusp 2010-04-01 12:07:40.378407398 +0200 +++ pm-utils-1.3.0/pm/module.d/uswsusp 2010-04-01 12:31:10.235228812 +0200 @@ -5,6 +5,7 @@ uswsusp_hooks() { disablehook 99video "disabled by uswsusp" + disablehook 90chvt "disabled by uswsusp" } # Since we disabled 99video, we need to take responsibility for proper @@ -35,8 +36,52 @@ # if we were told to ignore quirks, do so. # This is arguably not the best way to do things, but... [ "$QUIRK_NONE" = "true" ] && OPTS="" + S2RAM_OPTS="$S2RAM_OPTS $OPTS" + echo "INFO: S2RAM_OPTS from HAL quirks: '$S2RAM_OPTS'." } +# this function tries to assemble the best s2ram options from various sources, falling back +# to other methods... +get_s2ram_opts() +{ + # if S2RAM_OPTS is set - then use it. The user told us so. Obey his wish. + if [ -n "$S2RAM_OPTS" ]; then + echo "INFO: using user-supplied options: S2RAM_OPTS='$S2RAM_OPTS' for suspending." + return + fi + + # ... try to use s2ram as a source + if [ "$S2RAM_QUIRKS_SOURCE" = "s2ram" ]; then + if /usr/sbin/s2ram -n >/dev/null; then + echo "INFO: using s2ram built-in database, machine is supported." + return + else + echo "WARN: S2RAM_QUIRKS_SOURCE=s2ram, but machine is unknown, continuing..." + fi + fi + + # ... if is not known or not set as a source, use the built-in database + echo "INFO: using built-in quirks database from HAL." + uswsusp_get_quirks + if [ -n "$S2RAM_OPTS" ]; then + S2RAM_OPTS="--force "$S2RAM_OPTS + fi + + # ... in a case we still don't have any quirk, try s2ram for sure + if [ -z "$S2RAM_OPTS" ]; then + # ... machine could be in s2ram whitelist + if /usr/sbin/s2ram -n >/dev/null; then + echo "INFO: machine is in s2ram database, using it." + return; + else + # if we came here and S2RAM_OPTS is empty, suspend won't work :-( + echo "WARNING: smart uswsusp did not found any appropriate option, suspend probably don't work" + fi + fi + +} + + # Since we disabled 99video, we also need to handle displaying # help info for the quirks we handle. uswsusp_help() @@ -70,8 +115,8 @@ SUSPEND_MODULE="uswsusp" do_suspend() { - uswsusp_get_quirks - s2ram --force $OPTS + get_s2ram_opts + s2ram $S2RAM_OPTS } if [ "$METHOD" = "suspend" ]; then add_before_hooks uswsusp_hooks @@ -87,7 +132,11 @@ HIBERNATE_MODULE="uswsusp" do_hibernate() { - s2disk + if [ -z "${S2DISK_CONF}" ]; then + s2disk + else + s2disk --config $S2DISK_CONF + fi } fi @@ -98,8 +147,12 @@ SUSPEND_HYBRID_MODULE="uswsusp" do_suspend_hybrid() { - uswsusp_get_quirks - s2both --force $OPTS + get_s2ram_opts + if [ -z "${S2DISK_CONF}" ]; then + s2both --force $S2RAM_OPTS + else + s2both --config $S2DISK_CONF $S2RAM_OPTS + fi } if [ "$METHOD" = "suspend_hybrid" ]; then add_before_hooks uswsusp_hooks ++++++ pm-utils-1.3.0-upower.patch ++++++
From e8d0b58a9df080f021d04b4c2d358003974092f3 Mon Sep 17 00:00:00 2001 From: Michal Schmidt <mschmidt@redhat.com> Date: Tue, 23 Feb 2010 13:57:05 +0000 Subject: on_ac_power: support UPower (new name for DeviceKit-power)
DeviceKit-power got renamed to UPower and its D-Bus interface changed accordingly. Try UPower first in on_ac_power. If it fails, try DeviceKit-power. It if fails too, try hal. Also update documentation. Signed-off-by: Michael Biebl <mbiebl@gmail.com> --- diff --git a/man/pm-action.xml b/man/pm-action.xml index ccb4153..6e9f639 100644 --- a/man/pm-action.xml +++ b/man/pm-action.xml @@ -104,7 +104,7 @@ For some options external programs are needed. </para> <para> - These commands will usually be called by <command>DeviceKit-power</command> + These commands will usually be called by <command>UPower</command> or <command>hald</command> when triggered to do so by a program in a desktop session such as <command>gnome-power-manager</command>. Calling them from the command line is also possible, but it is not diff --git a/man/pm-is-supported.xml b/man/pm-is-supported.xml index 88bb9fd..d07c87d 100644 --- a/man/pm-is-supported.xml +++ b/man/pm-is-supported.xml @@ -89,7 +89,7 @@ <para> The intended purpose of <command>&dhpackage;</command> is to find out which power management modes are supported by the - system. hald(8) will call it to do just that. (Note that DeviceKit-power + system. hald(8) will call it to do just that. (Note that UPower does not use this.) </para> </refsect1> @@ -161,10 +161,6 @@ <!-- In alpabetical order. --> <para> <citerefentry> - <refentrytitle>DeviceKit-power</refentrytitle> - <manvolnum>7</manvolnum> - </citerefentry>, - <citerefentry> <refentrytitle>hald</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>, @@ -175,6 +171,10 @@ <citerefentry> <refentrytitle>s2both</refentrytitle> <manvolnum>8</manvolnum> + </citerefentry>, + <citerefentry> + <refentrytitle>UPower</refentrytitle> + <manvolnum>7</manvolnum> </citerefentry> </para> </refsect1> diff --git a/src/on_ac_power b/src/on_ac_power index fdbcb36..1f9c59e 100755 --- a/src/on_ac_power +++ b/src/on_ac_power @@ -30,7 +30,17 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# prefer DeviceKit-power if available +# prefer UPower if available +if s="$(dbus-send --system --print-reply \ + --dest=org.freedesktop.UPower \ + /org/freedesktop/UPower \ + org.freedesktop.DBus.Properties.Get \ + string:org.freedesktop.UPower string:OnBattery)"; then + echo "$s" | grep -q 'boolean false' + exit $? +fi + +# try its old name 'DeviceKit-power' too if s="$(dbus-send --system --print-reply \ --dest=org.freedesktop.DeviceKit.Power \ /org/freedesktop/DeviceKit/Power \ -- cgit v0.8.3-6-g21f6 ++++++ pm-utils-1.2.6.1.tar.bz2 -> pm-utils-1.3.0.tar.bz2 ++++++ ++++ 3075 lines of diff (skipped) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org