Howto: faster suspend and better power management (update)

Discussion in 'Linux' started by annafil, Sep 3, 2008.

  1. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    Happy: :)Aw shucks. If the update messes with the scripts, run the steps of the howto again and you will be fine - I tested it.
     
    annafil, Sep 8, 2008
    #21
  2. annafil

    Deoki

    Joined:
    Jul 22, 2008
    Messages:
    39
    Likes Received:
    0
    Location:
    Cascais > Lisbon > Portugal > Europe
    Dear God (and I am atheist!), my jaw droped once I instaled the latest Live Updates.

    Thanks to you now I have, once again, the sweet Gnome Power Manager up and running.

    The only thing left to fix is the WEP key not to be remembered. I guess the latest Network Manager update gave amnesia to the One. :(

    EDIT: Latest Live Update Network Manager Patch resolved the touchpad issue. :)
    Gotta redo all the steps to regain my dear gnome power manager though... :(
    This is going to be mandatory everytime we live update, or there will be a script to automate these steps?

    EDIT 2: Nop, the touchpad died again after a reboot. I'm starting to getting sick of these setbacks.
    There has to be a way to get around this.
     
    Deoki, Sep 9, 2008
    #22
  3. annafil

    Casao

    Joined:
    Aug 9, 2008
    Messages:
    28
    Likes Received:
    0
    Hey, thanks for writing this - it's really nice.

    I was wondering if you could give me some help with an ubuntu version? Since we already have Gnome running on ubuntu, it'd be great to get this working on there. If you shoot me an email or im ([email protected] and Draecas on AIM) I'd love to discuss it with you and get some work done, hopefully we could include it in Onelinux.
     
    Casao, Sep 10, 2008
    #23
  4. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    Deoki: not all live updates change the files that are modified in this howto. You're gonna have to try out the updates and see what happens.

    I'm gonna write a howto on full system backups, that way we all can safely experiment! :)

    Casao: sure! see u on IM
     
    annafil, Sep 10, 2008
    #24
  5. annafil

    champagj

    Joined:
    Aug 17, 2008
    Messages:
    32
    Likes Received:
    0
    Location:
    Toronto, Canada
    Error on resume...

    At first this patch worked well.

    I did it after the lasted updates.

    I only did "part 1" and did not replace the KPowersave engine.

    Now on wake-up I get "KPowersave : an error occur when suspend to RAM - Error 1"

    I also lose wlan on some occasions?

    Any ideas?

    Thanks,
     
    champagj, Sep 14, 2008
    #25
  6. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    have you "mv"-ed all the files from /usr/lib/pm-utils/sleep.d?

    have you made any other changes to the system after patching the suspend? (more updates, new applications, advanced desktop?)
     
    annafil, Sep 14, 2008
    #26
  7. annafil

    champagj

    Joined:
    Aug 17, 2008
    Messages:
    32
    Likes Received:
    0
    Location:
    Toronto, Canada
    Annafil,

    Yes, the sleep.d directory is empty

    I have advanced desktop running, along with VLC, Thunderbird, GIMP. I can't say I have done too much damage since I'm new to Linux. I did messed-up pretty good at the beginning but I did a clean re-load since.

    Is it caused by the fact I'm still running KPowersave? I could try loading the other power management app to see..

    As a side note: this is intermittent. Does not happen on all occasions.

    Weird.. :cool:
     
    champagj, Sep 14, 2008
    #27
  8. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    intermitten eh? :) so it gets even more interesting...

    Ok, try this simple test. Power down the machine, boot back up. Suspend. Unsuspend. Suspend again, Unsuspend (ie 2 times). See if it gives you the kpowersave error the second time around - I've had a issue with a second consecutive suspend before after a round of updates from Acer
     
    annafil, Sep 14, 2008
    #28
  9. annafil

    champagj

    Joined:
    Aug 17, 2008
    Messages:
    32
    Likes Received:
    0
    Location:
    Toronto, Canada
    Well this time it looks I score each time..


    An unknown error occurred while Suspend to RAM. The errorcode is: '1'


    is what I get.

    I first try with the LAN connection and it came back ok each time.

    Same result with WLAN. I dont seem able to reproduce the WLAN dropout.

    So I'm just left with an annoying msg.

    Should I try to install the other power app? As a matter of fact the battery life on the 3 cells is not good so maybe a little twicking..

    :roll:
     
    champagj, Sep 15, 2008
    #29
  10. annafil

    Afterimage

    Joined:
    Jul 19, 2008
    Messages:
    5
    Likes Received:
    0
    The Gnome Power Manager works really great, thanks.

    I have only one issue in that the Power Center under Settings still points to the kpowersave. How do we edit the powercenter.desktop in order to have it execute the gnome-power-manager instead of the kpowersave?

    I've already tried swapping out the "kpowersave" with "gnome-power-manager" in the powercenter.desktop with no success

    Thanks
     
    Afterimage, Sep 15, 2008
    #30
  11. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    AfterImage: Actually, you've got it right. I got mine to work by editing /usr/share/applications/powercenter.desktop and changing the exec line to this: Exec=gnome-power-manager.

    You may need a restart before you see any changes in your desktop shortcuts...

    Champagj: From what the great and powerful google tells me, it's a common error message and seems to be specific to kpowersave. You may want to try installing gnome power manager using the second part of my instructions in that case. You can always easily go back to kpowersave later ifyou don't like it.
     
    annafil, Sep 15, 2008
    #31
  12. annafil

    Afterimage

    Joined:
    Jul 19, 2008
    Messages:
    5
    Likes Received:
    0
    Thanks, I made the necessary change and it seems to work fine
     
    Afterimage, Sep 16, 2008
    #32
  13. annafil

    zero9046

    Joined:
    Sep 1, 2008
    Messages:
    19
    Likes Received:
    0
    can someone post the "mousepad" file contents for the original code (that comes with the AA! out of the box) for step one? I thought I did the correct code to back that file up, but apparently I did not, and I'd prefer not to have to wipe the computer back to its factory state just that. Thanks.
     
    zero9046, Sep 18, 2008
    #33
  14. annafil

    annafil

    Joined:
    Aug 12, 2008
    Messages:
    327
    Likes Received:
    0
    Location:
    Malaysia
    zero: the original code below

    Code:
    #!/bin/sh
    
    alarm_not_supported() {
    	echo org.freedesktop.Hal.Device.SystemPowerManagement.AlarmNotSupported >&2
    	echo Waking the system up is not supported >&2
    	exit 1
    }
    
    unsupported() {
    	echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
    	echo No suspend method found >&2
    	exit 1
    }
    
    read seconds_to_sleep
    
    # Make a suitable command line argument so that the tools can do the correct
    # quirks for video resume.
    # Passing the quirks to the tool allows the tool to not depend on HAL for data.
    QUIRKS=""
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_BIOS" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-bios"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_MODE" = "true" ] && QUIRKS="$QUIRKS --quirk-s3-mode"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_SUSPEND" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-suspend"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON" = "true" ] && QUIRKS="$QUIRKS --quirk-dpms-on"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbestate-restore"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE" = "true" ] && QUIRKS="$QUIRKS --quirk-vbemode-restore"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3" = "true" ] && QUIRKS="$QUIRKS --quirk-vga-mode3"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST" = "true" ] && QUIRKS="$QUIRKS --quirk-vbe-post"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_RADEON_OFF" = "true" ] && QUIRKS="$QUIRKS --quirk-radeon-off"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS" = "true" ] && QUIRKS="$QUIRKS --quirk-reset-brightness"
    [ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_NONE" = "true" ] && QUIRKS="$QUIRKS --quirk-none"
    
    QUIRKS="$QUIRKS --quirk-dpms-suspend"
    # Urh. Do any BIOSen handle this correctly?
    if [ $seconds_to_sleep != "0" ] ; then
    	alarm_not_supported
    fi
    export DISPLAY=":0.0"
    # We only support pm-utils
    tmppid=
    tmppid="`/sbin/pidof ucview`"
    tmpuser="`ps aux | grep xfce4-session | grep -v grep | awk '{print $1}'`"
    if [ "X$tmppid" != "X" ]; then
       echo `whoami` > /tmp/aa.txt
       echo $tmpuser > /tmp/aa.txt
       killall ucview
    fi
    
    rm -rf /dev/video[0-9]
    #/sbin/rmmod uvcvideo
    #/sbin/rmmod videodev
    #/sbin/rmmod r8101
    
    #/usr/bin/rm_driver.sh
    #sleep 1
    if [ -x "/usr/sbin/pm-suspend" ] ; then
    	/usr/sbin/pm-suspend $QUIRKS
    	RET=$?
    else
    	# TODO: add support
    	unsupported
    fi
    
    #/sbin/rmmod uvcvideo
    sleep 1
    #/sbin/modprobe videodev
    #/sbin/modprobe uvcvideo
    #/sbin/modprobe r8101
    
    # Refresh devices as a resume can do funny things
    #/usr/bin/add_driver.sh
    for type in button battery ac_adapter
    do
    	devices=`hal-find-by-capability --capability $type`
    	for device in $devices
    	do
    		dbus-send --system --print-reply --dest=org.freedesktop.Hal \
    			  $device org.freedesktop.Hal.Device.Rescan
    	done
    done
    #if [ "X$tmppid" != "X" ]; then
    #   su -c ucview -l ${tmpuser} &
    #fi
    #for icam in `hal-find-by-property --key info.linux.driver --string uvcvideo`
    #do
    #dbus-send --system --print-reply --reply-timeout=2000 --dest=org.freedesktop.Hal \
    #			  $icam org.freedesktop.Hal.Device.Rescan
    
    #done
    /bin/uvcvideo.sh
    
    exit $RET
    
     
    annafil, Sep 19, 2008
    #34
  15. annafil

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    A simple fix for this is to change the last line of the suspend script from "exit $RET" to "exit".

    This doesn't really fix the error, just stops it from showing. In my case the error was caused by the "modprobe coretemp" in the script failing.
     
    retsaw, Jan 16, 2009
    #35
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.