Page 4 of 4 FirstFirst ... 234
Results 31 to 33 of 33

Thread: Laptop Load Cycle Bug Finally Fixed!

  1. #31
    Join Date
    Feb 2007
    Beans
    Hidden!

    Re: Laptop Load Cycle Bug Finally Fixed!

    Thanks for hanging in there Jay_Bee, and don't worry about the number of edits. It's obvious that you are starting to piece this together in your own mind, and that is good. (I have no idea whether you've had any experience with shell scripts before and I've asked you to do things that would scare some people.) If we can get this solved, and if nobody else has already file a bug report, I hope to file a bug report referencing this thread.

    Just so you know, that statement I had you add should not change what the script actually does. It just causes the script to show each line that it executes (sort of) so we can tell what is happening. (And I didn't think about all of the lines that would be spit out as a result of it "sourcing" laptop-mode.conf. :-/ )

    Quote Originally Posted by Jay_Bee View Post
    EDIT2: Hmmm... DO_HDPARM=n because CONTROL_HD_POWERMGMT=1 in laptop-mode.conf... Why set that as default?
    I am a bit surprised, because in Edgy (the reference I have) the default was 0. But as I pointed out in post #23 I think the script needs to be modified to not even check that unless lapt-mode is running. But we shouldn't need to worry about that to get you up and running.

    I changed the CONTROL_HD_POWERMGMT to 0 and after resuming the value remained 128 but running your script did the trick. ...

    Now... how to make the script actually run on resume?
    Just to double check that we understand each other, let me recap ...

    After changing CONTROL_HD_POWERMGMT to 0 (in laptop-mode.conf), manually running the modified script gives the expected result. That means the unmodified script should work also. You can easily verify this:

    Code:
    sudo /etc/acpi/ac.d/90-hdparm.sh
    sudo hdparm -I /dev/sda | grep -i power
    (You should start whith the disk's APM not set to 254 just to make sure the script actually did something!)

    My belief is that copies of that script (90-hdparm.sh) exist in the following directories:

    Code:
    /etc/acpi/resume.d
    /etc/acpi/start.d
    /etc/acpi/ac.d
    /etc/acpi/battery.d
    Could you double check that for me? If you want to make sure the files are in fact identical, you can use commands like:

    Code:
    cmp /etc/acpi/resume.d/90-hdparm.sh /etc/acpi/start.d/90-hdparm.sh
    which will compare those two files. If the command produces no outptut, the files are the same. (See note below about "tab completion" if you don't already know about it.)

    So if the unmodified script works (when run manually) and if it is in all of the locations I just mentioned, then I would think it should handle things correctly at start, when resuming from suspend or hibernate, and when switching to/from battery. If it does not, I may not be able to help you troubleshoot further. Please post back when you know for sure whether that is where we are.

    If there is anybody else following this thread who has an idea about this, please post! Otherwise I might just need to file the bug report w/o the complete solution and see what the developers come up with.



    TAB COMPLETION:

    You can save yourself a great deal of effort with commands that involve long path/filenames (and commands to!) like the cmp command above by using "tab completion." In that example, it you start typing "/etc/ac" and then hit the tab key, it will (at least partially) complete the rest if there is no ambiguity. In this case it will get you to "/etc/acpi/". You can type some more, hit tab again, etc., until finished with the parameter. If there is an ambiguity when you hit tab, it will beep. Just type another character or two and hit tab again. You can do this as many times in a command line as wish. And save yourself a lot of typing!

    ANOTHER TRICK:

    If you are going to run a series of commands that are almost the same, such as the three commands to compare those four files above, you can hit the "up arrow" on your keyboard to recall the previous command and then use left/right arrows, backspace and delete keys to make minor alterations. This is another great way to avoid typing.

  2. #32
    Join Date
    Jun 2007
    Beans
    192

    Re: Laptop Load Cycle Bug Finally Fixed!

    I am somewhat familiar with shell scripts, we had a Unix class last year, so I can find my way around.
    Quote Originally Posted by blackhole54 View Post
    After changing CONTROL_HD_POWERMGMT to 0 (in laptop-mode.conf), manually running the modified script gives the expected result. That means the unmodified script should work also. You can easily verify this
    You are right, I checked and it works as expected.
    My belief is that copies of that script (90-hdparm.sh) exist in the following directories
    Right again, files are there and cmp says they're the same.

    So if the unmodified script works (when run manually) and if it is in all of the locations I just mentioned, then I would think it should handle things correctly at start, when resuming from suspend or hibernate, and when switching to/from battery. If it does not, I may not be able to help you troubleshoot further.
    Well, everything looks right, but it doesn't work like it should.
    Unmodified script works for resume but ONLY when run manually, so I think we can conclude that, for some reason, on resume from suspend it either doesn't run or if it does, somehow the APM is being reset to 128 (after the script presumably switches it to 254).

    Interesting is that the same thing was happening with the 99-hdd-ugly-fix.sh in Hardy, I think I once read that other distro solved this by creating another script to make sure that the 90-hdparm.sh gets run on resume... I'll try to find that page again.
    I found a bug report about this issue (script not running on resume), the 90-hdparm.sh script needs to be copied to /etc/pm/sleep.d/
    https://bugs.launchpad.net/ubuntu/+s...rt/+bug/244839
    It is finally working now as it should!

    Thank you for all your help and tips blackhole54.
    Last edited by Jay_Bee; October 30th, 2008 at 12:36 PM.

  3. #33
    Join Date
    Feb 2007
    Beans
    48

    Re: Laptop Load Cycle Bug Finally Fixed!

    hmmmmm an ugly fix for the ugly fix

Page 4 of 4 FirstFirst ... 234

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
  •