DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-08-24 16:01:09

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Yet another fan controller

For the D-Link kernels there are temperature and fanspeed programs that use the unusual ioctl interface to read the temperature, and to read and set the fan speed. Community scripts are available that implement custom fan controllers.

For vanilla kernels, temperature and fan speed are accessible through files in the /sys tree. The lm_sensors packages includes the fancontrol bash script.

Both approaches use shell scripts, and you need different scripts for different kernels. Also, compared to compiled C programs, shell scripts clearly need more memory and CPU cycles. Because of this, I wrote a C program that works on both dlink and vanilla kernels. It needs different config files, though.

The attached tarball includes binary, C source, and two example config files. For the dlink firmware kernels, use fan.dns323.conf, and fan.conf for vanilla kernels. The dlink config contains the magic line "dns323=yes" to enable dlink mode, while fan.conf contains pointers to the files in /sys. Another important difference is that for dlink kernels, you really set the fanspeed, while for vanilla kernels, you set a PWM value (pulse-width modulation). Temperature is specified in milli C/F (i.e. 45 degrees C -> 45000).

Test fanctl with:

Code:

/path/to/fanctl /path/to/fan.dns323.conf

If it works, you can send it to background as usual:

Code:

/path/to/fanctl /path/to/fan.dns323.conf >/dev/null 2>/dev/null </dev/null &

You might want to redirect stdout to a log file instead, e.g. to create nice graphs with gnuplot.

I'm not sure about reasonable temperature and pwm settings. Please post the values that work best for you.

Note that the fanctl program will start at high speed for one full interval.


Attachments:
Attachment Icon fanctl-1.tar.gz, Size: 8,494 bytes, Downloads: 831

Offline

 

#2 2008-08-24 18:14:36

vedeja
Member
Registered: 2008-02-21
Posts: 161

Re: Yet another fan controller

Sounds good, I would like to test it. (Some additional idle CPU cycles are always welcome). Could you please be more precise on how to use the program?


¤ 2 x 500 GB Samsung Spinpoint ¤ FFP 0.5 ¤ Custom fanscript ¤
¤ Lighttpd 1.4.19 ¤ Transmission 1.50 ¤ FW 1.07 ¤

Offline

 

#3 2008-08-24 18:42:31

Jimmie
New member
Registered: 2008-08-15
Posts: 4

Re: Yet another fan controller

Gonna try this 1 out right away, since the ones from the Wiki keep my HD's awake (CH3SNAS, ffp from usb stick).


EDIT:

Adjusted the conf with a tiny bit higher temperatures (critical @ 60, low @ 38, high @ 53, interval 60)
Seems to be working perfectly so far, the HD's stay asleep, while having started this from the usb stick.


Perhaps a start script for use with ffp might come in handy, but I have no idea how to write those.

A question: does this put the fan off when below low temperature? Although I never seen the temperature that low it would be neat if it's fully silenced when no one is using the device.

Last edited by Jimmie (2008-08-24 19:53:24)

Offline

 

#4 2008-08-26 15:01:02

knireis
Member
Registered: 2007-12-10
Posts: 231

Re: Yet another fan controller

Can someone give a bit more detailed instructions on how to use this script?
I typed in /path/to/fanctl /path/to/fan.conf (with the correct path) and hit enter, but there are several error messages about the /sys/class/i2c-adapter/i2c-0/0-0048/temp1_input which does not exist.

I'm using a CH3SNAS.

Offline

 

#5 2008-08-26 15:09:11

timschuerewegen
Member
Registered: 2008-08-05
Posts: 6

Re: Yet another fan controller

knireis wrote:

Can someone give a bit more detailed instructions on how to use this script?
I typed in /path/to/fanctl /path/to/fan.conf (with the correct path) and hit enter, but there are several error messages about the /sys/class/i2c-adapter/i2c-0/0-0048/temp1_input which does not exist.

I'm using a CH3SNAS.

Which vanilla kernel are you running? Maybe you should read the initial post (again).

Last edited by timschuerewegen (2008-08-26 15:11:34)

Offline

 

#6 2008-08-26 15:21:13

knireis
Member
Registered: 2007-12-10
Posts: 231

Re: Yet another fan controller

timschuerewegen wrote:

knireis wrote:

Can someone give a bit more detailed instructions on how to use this script?
I typed in /path/to/fanctl /path/to/fan.conf (with the correct path) and hit enter, but there are several error messages about the /sys/class/i2c-adapter/i2c-0/0-0048/temp1_input which does not exist.

I'm using a CH3SNAS.

Which vanilla kernel are you running? Maybe you should read the initial post (again).

I don't know, i thought that vanilla meant other kernels than the dlink, so including my ch3snas. But vanilla might mean something else.

Offline

 

#7 2008-08-26 15:32:34

timschuerewegen
Member
Registered: 2008-08-05
Posts: 6

Re: Yet another fan controller

knireis wrote:

I don't know, i thought that vanilla meant other kernels than the dlink, so including my ch3snas. But vanilla might mean something else.

From http://en.wikipedia.org/wiki/Linux_kernel

Further developing his own code and integrating changes made by other programmers, Linus Torvalds keeps releasing new versions of the Linux kernel. These are called "vanilla" kernels, meaning they have not been further modified by anyone. Many Linux operating system vendors modify the kernels of their product, mainly in order to add support for drivers or features which have not officially been released as stable, while some distributions rely on vanilla kernels.

Did you try fan.dns323.conf? If it does not work (due to differences between DNS-323 and CH3SNAS hardware/kernels) then I am afraid Fonz will have to update his code.

Offline

 

#8 2008-08-26 15:36:27

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

timschuerewegen wrote:

Did you try fan.dns323.conf? If it does not work (due to differences between DNS-323 and CH3SNAS hardware/kernels) then I am afraid Fonz will have to update his code.

See Jimmie's post. He's got a CH3SNAS, too.

Offline

 

#9 2008-08-26 21:02:26

rap
Member
From: Reading - UK
Registered: 2008-02-28
Posts: 119

Re: Yet another fan controller

Hi fonz - will this new prog of yours kill the inbuilt fan process like the other scripts you refered to?

RAP

Offline

 

#10 2008-08-26 21:47:03

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

rap wrote:

Hi fonz - will this new prog of yours kill the inbuilt fan process like the other scripts you refered to?

No, you need to do that yourself.

Offline

 

#11 2008-08-26 23:42:10

ismora
Member
From: Paris, France
Registered: 2008-07-30
Posts: 30

Re: Yet another fan controller

I started using it (with fan.dns323.conf), thank you Fonz.

I tested by briefly closing the fan output, and measured temperature raised, and fan speed increased.
As Jimmie, I could not validate that the fan stops when disks are idle -- mine never are...

Last edited by ismora (2008-08-26 23:43:26)


DNS-323 • 2x Hitachi 500MB • RAID1 • FW1.04 • ext3 • Fonz's v0.5 fun_plug
DNS-325 • 2x WD Green 2TB • RAID1 • FW?.?? • ext3 • Fonz's v0.7 fun_plug

Offline

 

#12 2008-08-26 23:58:44

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

Jimmie wrote:

A question: does this put the fan off when below low temperature? Although I never seen the temperature that low it would be neat if it's fully silenced when no one is using the device.

I think the fan stops if you set pwm_lo low enough. However, it might not start until the controller sets fanspeed a little higher than the speed at which the fan stopped.

Offline

 

#13 2008-10-01 07:11:29

celcius0
New member
Registered: 2008-09-30
Posts: 3

Re: Yet another fan controller

hi,

I am using aDN323 with this script. What is the temperature unit being use here?
e.g. temp_lo=38000 means 38 C?
My DNS 323 uses F in previous fan control script found on the wiki. Does this mean I should convert the 38000 ?

Thanks

Offline

 

#14 2008-10-01 10:25:48

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

celcius0 wrote:

My DNS 323 uses F in previous fan control script found on the wiki. Does this mean I should convert the 38000 ?

It uses F because the 'temperature' programs prints Fahrenheit on your device. fanctl doesn't use this program. I suppose the best way to check is to run 'dns323-temp'. If it prints correct values, use Millicelsius in the fanctl config.

Offline

 

#15 2008-10-01 19:50:06

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: Yet another fan controller

Fan never stop to me either. I set temp_lo to 37, even temp is 32, fan speed is still 2700

Offline

 

#16 2008-10-01 20:22:44

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

noodle wrote:

Fan never stop to me either. I set temp_lo to 37, even temp is 32, fan speed is still 2700

Is this a question? It won't stop unless you tell it to.

Offline

 

#17 2008-10-01 20:25:40

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: Yet another fan controller

I c, I thought it going to stop if temp lower than temp_lo. How can I make it like that? if temperature low than temp_lo, stop the fan?

Offline

 

#18 2008-10-01 21:21:33

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

noodle wrote:

I c, I thought it going to stop if temp lower than temp_lo. How can I make it like that? if temperature low than temp_lo, stop the fan?

http://dns323.kood.org/forum/p20984-Yes … tml#p20984

Offline

 

#19 2008-10-02 18:47:25

DeLaCroix
Member
Registered: 2007-08-18
Posts: 91
Website

Re: Yet another fan controller

Instructions for the latest fancontroller: http://nas-tweaks.net/CH3SNAS:Tutorials/fancontrol

Offline

 

#20 2008-10-04 19:01:44

knireis
Member
Registered: 2007-12-10
Posts: 231

Re: Yet another fan controller

This fancontroller works good on my CH3SNAS. With previous fancontrol scripts, I usually had problems with disk spindown.
Initially after installing this package I lost spindown as well, but after changing the idle time interval in the webinterface from 10 to 15 and then back to 10 (with saving the setting in between) the spindown started working again. Don't know why but maybe this can help others with similar problems.

Offline

 

#21 2008-10-04 23:32:30

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: Yet another fan controller

DeLaCroix wrote:

Instructions for the latest fancontroller: http://nas-tweaks.net/CH3SNAS:Tutorials/fancontrol

Installed as per instruction and working fine.

With appreciation for a job well done


Bob Blackwell
Pickering, ON

Offline

 

#22 2008-10-31 06:41:54

DaveN
Member
Registered: 2008-01-12
Posts: 21

Re: Yet another fan controller

Works great.  Can I suggest an improvement though?

I'd like to also monitor the hard drive status.  If the drives are active, do not power off the fan (leave it at the pwm_lo speed).

The reason I request this is so that the fans will start cooling when the drives activate, instead of delaying until the temperature rises.

On a related note, I have recently seen the temperature and fanspeed functions fail on my device (DNS-323 FW 1.05).  This failure occured when I was playing around with other fan control scripts, so it may or mat not occur under normal circumstances.  When the functions fail, temperature always returns 0 C (or 32 F), while fanspeed returns ~2533 (the fan was off at the time).  Similarily the dns323-temp ("0 C 32 F") and dns323-fan ("2533 2533 194") commands return invalid results.  I will try to create a script to replicate this bug.

Cheers,
Dave.

Offline

 

#23 2008-10-31 09:26:19

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

DaveN wrote:

On a related note, I have recently seen the temperature and fanspeed functions fail on my device (DNS-323 FW 1.05).

See http://dns323.kood.org/forum/viewtopic. … 67&p=1

Offline

 

#24 2008-10-31 11:20:59

Loose Gravel
Member
Registered: 2008-10-14
Posts: 50

Re: Yet another fan controller

DaveN wrote:

I'd like to also monitor the hard drive status.  If the drives are active, do not power off the fan (leave it at the pwm_lo speed).

I second that.

I would propose this logic:

Code:

if (isAnyDiskSpinning())
{
   currentTemp = maximum (getCurrentTemp() ; temp_lo + 0.01)
      /* so currentTemp is > temp_lo --> fan will start if not currently running and will never stop when a disk is spinning */
   spinningState = true /* remember that disks are spinning for later on */
}
else
{ /* no disk is spinning */
   currentTemp = getCurrentTemp()
   if (spinningState == true)
   {
       /* so disks have just shutdown */
       if ( currentTemp <= temp_lo)
       {
             /* Disks stopped, temp low, so turn of fan */

            setFanSpeedTo(pwm_start); sleep 30
            /* power up already running fan for 30 seconds to cool just stopped disks a bit
             * dont know if this is needed to prevent fan from starting later on, so
             * this is experimental and SHOULD be configurable :-)  */

            setFanSpeedTo(pwm_stop)  /* thus turn of fan, if pwm_stop == 0 (default) */
       }
       spinningState = false /* remember that disks are NOT spinning for later on */
   }
}

/* continue with current behavier using currentTemp as actual temperature reading */
...

This will power on the fan as soon as a disk starts spinning and power off the fan when disks are shut down and temperature allows it. The experimental bit will power up the fan prior to turning it off to cool things a litte more.

EDIT: Typo

Last edited by Loose Gravel (2008-10-31 11:27:18)

Offline

 

#25 2008-10-31 11:38:30

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Yet another fan controller

Code to detect disk state for firmware kernels is in dns323-spindown.c ( http://www.inreto.de/dns323/utils/dns32 … 176.tar.gz ). The fanctl source code is available from the same directory ( http://www.inreto.de/dns323/utils/fanctl-2.tar.gz ). I'm not that interested in this feature, but this is open source. Feel free to add it yourself.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB