Page 1 of 7 123 ... LastLast
Results 1 to 10 of 65

Thread: Fan control script

  1. #1
    Join Date
    Mar 2009
    Location
    /home/joushou
    Beans
    30
    Distro
    Ubuntu 9.10 Karmic Koala

    Talking Fan control script

    I've been having a really hot laptop in ubuntu, like i had in OS X before i installed fan-control.
    I looked around the net, and figured i wasn't alone, but i could only find 1 script (SantaRosaFanControl i believe), which i didn't quite like...

    So, i wrote my own, which also counts fans and sensors by itself, so it should work on anything that the applesmc module supports
    All settings are in the top (min/max fan-speeds, min/max temp, so forth), though i wouldn't suggest setting the manFanControl flag to true... if applesmc wants the fans to spin, it probably have a good reason

    It's probably not the prettiest thing in the world (haven't been scripting in a while...), but i hope someone will have use of it

    By the way, is there anyone who knows which sensor is which on MBP3.1?

    Anyway, enjoy

    Description:
    This script is designed to automatically recognize fans and sensors on any Apple computer that uses the applesmc kernel module for fans and temperature sensors.
    It will also take temperature-input from the coretemp kernel-module if loaded.
    It might be very buggy, though!

    So far, i'm aware of successful use on various MacBook Pro's and MacBook's...

    Changelog:
    Code:
    0.1: First version
    0.2: Added fatal function, and the debugTo variable
    0.2.1: Zipped it with an init and install script
    0.2.2, Install script now starts smcfancontrol after install
    0.3: Added cornelius2's coretemp/gradual-update-patch, and included a readme, together with a simple fix for the random suicides...
    0.3.1: Typo...
    0.3.2: Fix potential non-laptop bug
    Sorry for the lack of interest in my script, but i'm not using Ubuntu as heavily as i used to (Actually, i screwed up GRUB when i installed Snow Leopard, so i haven't booted it in a while )
    UPDATE: I installed Karmic on top of my old install, so i'm up and running on Ubuntu again! But now i'm screwed, 'cause i lost my custom keymap 'n stuff... D': (The DK-Mac keymap is actually just the usual DK map, which doesn't work well on a Mac keyboard...)
    Attached Files Attached Files
    Last edited by Joushou; November 9th, 2009 at 10:41 PM. Reason: You don't want to know. No really, you don't.
    Once upon a time, there was.
    Then, there wasn't.
    - A description of life, the universe, and everything.

  2. #2
    Join Date
    Feb 2006
    Beans
    108

    Re: Fan control script

    Thanks for sharing the script.

    Are those the actual max and min temperatures in the script??

    I started the script and it started with max fan speed... and it never goes to lower speed.

    Mine is macbook 3,1

    I guess I need to tweak the values.

    These are my current temperatures from libsensors applet
    temp1 - 27
    2 - 37
    3 - 36
    4- 43
    5-37
    6- 65
    7-51
    8 - 36
    9 - 36
    10 - 36

  3. #3
    Join Date
    Mar 2009
    Location
    /home/joushou
    Beans
    30
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Fan control script

    Well, i'm glad someone wanted to use it!

    Min and max temperature values set when it should stop cooling, and when it should prepare for take-off (Full-speed).

    If you copy-pasted this script, it should run fine... thats the exact copy of my currently running script... and thats on my MBP3,1

    What temperatures is it reading when it goes to max fan-speed? Paste a couple of debug lines where it's at max-speed with a too low temperature, and if you changed the values at the top, give me them aswell, so i can see whats going wrong
    Last edited by Joushou; March 27th, 2009 at 07:41 AM. Reason: I like cookies
    Once upon a time, there was.
    Then, there wasn't.
    - A description of life, the universe, and everything.

  4. #4
    Join Date
    Feb 2006
    Beans
    108

    Re: Fan control script

    Output:

    sudo ./fan.sh
    27/03 03:27:30: Fans: 1
    27/03 03:27:30: Min fan-speed: 2000
    27/03 03:27:30: Max fan-speed: 5000
    27/03 03:27:30: Sensors: 10
    27/03 03:27:30: Limited by user to 6
    27/03 03:27:30: Laptop: true
    27/03 03:27:30: ACPI-State: online
    27/03 03:27:30: Temperature: 65, Fan-speed: 5000, ACPI-State: online


    temps are almost the same as in the above post.
    I didn;t chage any values in the script.. [edit]oops, I changed 6000 to 5000[/edit]

    By the way, I like your signature. Who said that?

  5. #5
    Join Date
    Mar 2009
    Location
    /home/joushou
    Beans
    30
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Fan control script

    Thanks, it's just one i liked from bash.org... can't remember who it was, i saw it 2-3 months ago or something (For some reason, i got static quote memory, while i can't remember time at all )

    To fix your problem, set "sensorsUsed" to 4 or 5. Your sensor 6 seems to be as hot as my sensor 7 (Which is why i implemented the sensor limit... so it wouldn't have to run at 6000RPM always ).
    "sensorsUsed" limits the number of sensors to use, 6 means it would use sensor 1-6... and your sensor 6 is always hot, so it will run at max speed.

    You could also change it to use the "average" temperature calculation, but i prefer my "highest" calculation (Takes the highest temperature, so no components get too hot... with average, 1 sensor could be 20 degrees, while another could be 80... then it would cool as if it was 50 degrees, and the second component could maybe be damaged).

    Changing fanMaxSpeed to 5000 is OK... Just don't put it too low, or the script won't give much cooling

    I have just changed sensorsUsed to be 5 in the first post, so we won't have that problem again with macbooks
    Last edited by Joushou; November 9th, 2009 at 10:42 PM. Reason: Oranges
    Once upon a time, there was.
    Then, there wasn't.
    - A description of life, the universe, and everything.

  6. #6
    Join Date
    Feb 2006
    Beans
    108

    Re: Fan control script

    Thanks. It is working now.

    I added a link to this page in Arch Linux wiki - macbook

    http://wiki.archlinux.org/index.php/MacBook#Fan_Speed

  7. #7
    Join Date
    Apr 2007
    Location
    Northern California
    Beans
    32
    Distro
    Ubuntu

    Re: Fan control script

    Am I correct in assuming I should make it executable and copy it to /init.d/ to be run at boot with update-rc.d?
    Blawrgiddy blawrgiddy blawr, Ubuntu.

  8. #8
    Join Date
    Feb 2006
    Beans
    108

    Re: Fan control script

    I added it to rc.local

  9. #9
    Join Date
    Mar 2009
    Location
    /home/joushou
    Beans
    30
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Fan control script

    @sands: Good, then arch-users can enjoy the fruits of my bashfu... or something


    @hellmitre: Well, it would work for starting it, but when it attempts to stop it, it would be started again instead of killed.

    I've just zipped the script with a modified version of "fancontrol"s (PWM-fan controller) init-script, and an installer script.
    Remember to run the installer script as root, or it will yell at you.
    Last edited by Joushou; March 28th, 2009 at 11:52 AM. Reason: I went to the dark side... and they were out of cookies
    Once upon a time, there was.
    Then, there wasn't.
    - A description of life, the universe, and everything.

  10. #10
    Join Date
    Apr 2007
    Location
    Northern California
    Beans
    32
    Distro
    Ubuntu

    Re: Fan control script

    I think you left out a $ in one of the last lines of the script, as well as an 's' at the end of defaults:
    Code:
    update-rc.d $initscript defaults $scriptrlevel || fatal "Failed to install rc-scripts"
    When I ran the script as root, it told me that it failed to install the rc-scripts. I added the $ to scriptrlevel and it ran.
    Blawrgiddy blawrgiddy blawr, Ubuntu.

Page 1 of 7 123 ... LastLast

Tags for this Thread

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
  •