Results 1 to 10 of 10

Thread: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

  1. #1
    Join Date
    May 2007
    Beans
    132

    [SOLVED] How to make Laptop-Mode resume after suspend

    I would like to create a script similar to what is suggested in this thread.

    Does anyone know what it should look like, and where I should put it?

    To address excessive load cycling I followed the guide on the Ubuntu Wiki.
    Last edited by AbtZ; August 11th, 2008 at 07:02 AM. Reason: created proper thread title

  2. #2
    Join Date
    May 2007
    Beans
    132

    Re: How to make Laptop-Mode resume after suspend

    Well, that's what you get for posting when you really should be sleeping. The thread title is stupid and totally misleading; the "doesnt" shouldn't be in it.

    In any case, I managed to solve the problem myself. I created a script
    Code:
    sudo gedit /etc/pm/sleep.d/10laptopmoderestart
    with the code

    Code:
    #!/bin/bash
    case $1 in
        hibernate)
            /etc/init.d/laptop-mode stop
            ;;
        suspend)
            /etc/init.d/laptop-mode stop
            ;;
        thaw)
            /etc/init.d/laptop-mode start
            ;;
        resume)
            /etc/init.d/laptop-mode start
            ;;
        *)
            echo Something is not right.
            ;;
    esac
    Then I made it executable with
    Code:
    sudo chmod +x /etc/pm/sleep.d/10laptopmoderestart
    Done! laptop mode works as intended, and restarts after resuming from suspend/hibernate

  3. #3
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    Hi!

    I don't know much about writing scripts. Could someone explain what is the purpose of "case $1" and "esac" in this script?

    Kaur

  4. #4
    Join Date
    May 2007
    Beans
    132

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    It is a way to avoid nested "if" statements. "case" is the beginning of such a switch, "esac" signifies its end.

    For more info: http://tldp.org/LDP/Bash-Beginners-G...ect_07_03.html

  5. #5
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    Hi!

    Ok, thanks for the information.

    K

  6. #6
    Join Date
    Aug 2006
    Beans
    5

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    Nope. Thanks for the tip, but on my HP laptop, this does not work...

  7. #7
    Join Date
    May 2007
    Beans
    132

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    I did this on Hardy. Maybe it works differently in Intrepid?

  8. #8
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    shouldn't there be a - in the filename? Like this 10-laptopmoderestart.

  9. #9
    Join Date
    May 2007
    Beans
    132

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    Don't think it matters. The numbers in the names are just to make the scripts execute in a certain order.

  10. #10
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: [SOLVED] How to make Laptop-Mode doesnt resume after suspend

    Quote Originally Posted by AbtZ
    Don't think it matters. The numbers in the names are just to make the scripts execute in a certain order.
    I know, but I thought that maybe the system gets confused if the number isn't separated in any way. You're probably right though, that it doesn't matter.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •