amilo-forum.de

Inoffizielles Forum rund um die Notebooks der Amilo- und Lifebook-Serien von Fujitsu

FSC Amilo XA 3530 Lüftersteuerung Kernel Modul

Alle Fragen, die sich speziell um Linux oder andere Unix-ähnliche Betriebssysteme drehen.

FSC Amilo XA 3530 Lüftersteuerung Kernel Modul

Beitragvon Peking-Ente » 18.09.2011 18:28

First off, I found it difficult to make my fan work on my laptop with Linux. The fan was always on. At some point I found it very disturbing. Second, I've found the fan power switch in the embedded controller (register 0x93, bit 2^4 is the off-button, bit 2^2 is the on-button) but I didn't found how to control the fan speed. And I wanted like stone age to make a kernel module and thank to the internet I decided to build a kernel module. The fan kernel module and it controls can be modified by /dev/fanctl (cat /dev/fanctl). Please note that it can only control the power switch not the speed itself, but when the laptop is idle at 550 Mhz, the kernel module cannot harm the device. The module polls the temperature every 10 second and when the temperature goes beyond 85°C it switch on the fan. The module has a built-in hysterese, that means once the fan is on it turns 2x ( 20 second ) times longer then needed. That is to cool down the cpu. The fan speed RPM control is just a wild guess and it's taken from the internet.

Commands for the kernel module:

"O" = fan on
"X" = fan off
"A" = fan software control
"D" = fan user/hardware control

Here is the software definition of the fan software control:

/* Define non-numeric command characters */
#define FAN_ON_CHAR 'O'
#define FAN_OFF_CHAR 'X'
#define FAN_AUTO_CHAR 'A'
#define FAN_DEFAULT_CHAR 'D'
#define FAN_LOOP 10
#define FAN_JIFFIES_MS 10
#define FAN_UPTHRESHOLD_TEMP 85

How to install: Download the files in the link to a folder then run make and insmod fscxa3650fan.ko. Check the fan status with cat /dev/fanctl.

Enjoy a silent laptop and take care!

Download: http://bit.ly/o6otCt

fan-1.png
fan-1.png (8.36 KiB) 3810-mal betrachtet
fan-2.png
fan-2.png (7.8 KiB) 3810-mal betrachtet
fan-3.png
fan-3.png (8.02 KiB) 3810-mal betrachtet


EDIT: Upps, I have a FSC Amilo XA 3530 not 3650. I change the name later.
Zuletzt geändert von Peking-Ente am 20.09.2011 11:03, insgesamt 4-mal geändert.
Peking-Ente
 
Beiträge: 21
Registriert: 15.07.2009 15:13

Re: FSC Amilo XA 3650 Lüftersteuerung/fan control kernel mod

Beitragvon hikaru » 18.09.2011 20:47

Thanks a lot for your work!

I just tried to compile your module on Debian Squeeze i686 but ran into the following error:
Code: Alles auswählen
hikaru@debianbox:~/Downloads/xa3650fan$ make
make -C /lib/modules/2.6.32-5-686/build M=/home/hikaru/Downloads/xa3650fan modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-5-686'
  CC [M]  /home/hikaru/Downloads/xa3650fan/fscxa3650fan.o
/home/hikaru/Downloads/xa3650fan/fscxa3650fan.c: In function ‘WEIE’:
/home/hikaru/Downloads/xa3650fan/fscxa3650fan.c:351: error: implicit declaration of function ‘inb’
/home/hikaru/Downloads/xa3650fan/fscxa3650fan.c: In function ‘WMFN’:
/home/hikaru/Downloads/xa3650fan/fscxa3650fan.c:363: error: implicit declaration of function ‘outb’
make[4]: *** [/home/hikaru/Downloads/xa3650fan/fscxa3650fan.o] Fehler 1
make[3]: *** [_module_/home/hikaru/Downloads/xa3650fan] Fehler 2
make[2]: *** [sub-make] Fehler 2
make[1]: *** [all] Fehler 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-5-686'
make: *** [all] Fehler 2

I googled a bit and it seems like inb and outb are defined in some io.h. So I obtained the sources of my kernel headers and looked for such a file. I found one at:
Code: Alles auswählen
/usr/src/linux-headers-2.6.32-5-common/include/asm-generic/io.h
I copied it to the folder where I stored the sources for your module, added an include statement to your header
Code: Alles auswählen
#include <io.h>
and successfully compiled the module.

I know that's not the proper way to include the additional header but given the circumstance that obtaining the complete header sources means downloading 80MB+ in Debian and probably lots of other distributions too I think it might me helpful to add a download link for io.h to your website.

Unfortunately I have no Xa 3650 so I can't give any feedback on the functionality of the module. However, now that I compiled the module anyway I'll attach the binary here just in case.
btw: May I ask which distribution you use?
Dateianhänge
fscxa3650fan.ko.zip
(3.4 KiB) 174-mal heruntergeladen
Benutzeravatar
hikaru
Moderator
 
Beiträge: 3780
Registriert: 25.10.2007 10:23
Notebook:
  • Asus EEE 1018p
  • Nokia N900
  • Dell Precision M6500
  • Asus EEE 901
  • Amilo Si 1520
  • Desktop (alt)

Re: FSC Amilo XA 3650 Lüftersteuerung/fan control kernel mod

Beitragvon Peking-Ente » 18.09.2011 21:12

I'm totally new to linux kernel module developement, so please excuse my dumb questions but I really don't know what happens, I'm using OpenSUSE 11.4 for my programs and everything but I use the Zen-Kernel 3.0.4-zen+ for the Linux kernel. Do you think it's good to include io.h in my header? I wonder where my kernel module get's it io.h because of your error? I can also find io.h in include/asm-generic/io.h which is the git repository of 3.0.4-zen+. And also what purpose it is to attach a binary kernel module? Isn't it a kernel module highly dependent from the linux kernel version?
Peking-Ente
 
Beiträge: 21
Registriert: 15.07.2009 15:13

Re: FSC Amilo XA 3650 Lüftersteuerung/fan control kernel mod

Beitragvon hikaru » 19.09.2011 09:17

I don't have much experience with kernel module development either. Including io.h in your header should be safe. If it's not present on the system make should throw an error message but compile your module anyway if the functions inb and outb are declared elsewhere. To find out what's different between Debian's and Suse's kernel headers you could grep for those functions in the headers you've already included.
Yesterday evening I tried to reproduce what you did in a Suse VM but it's too long ago since I've used Suse so I couldn't remember how to correctly obtain and install the kernel headers. But it seems to me like you have them installed anyway since Suse without them will throw even more errors than Debian.

You're right with the kernel dependency of modules. The module I created will only work for sure on systems which use the i686 Debian stable kernel. Other 2.6.32 kernels or even other versions might work as well as long as the kernel's ABI hasn't changed but there's no easy way to tell that. So providing a whole bunch of pre-compiled modules wouldn't make much sense because it would have to be done separately for every version of every distribution in every compatible architecture which would be overkill. I just attached the Debian module because because I've created it anyway and maybe someone will have more use for it than I do.
Benutzeravatar
hikaru
Moderator
 
Beiträge: 3780
Registriert: 25.10.2007 10:23
Notebook:
  • Asus EEE 1018p
  • Nokia N900
  • Dell Precision M6500
  • Asus EEE 901
  • Amilo Si 1520
  • Desktop (alt)

Re: FSC Amilo XA 3650 Lüftersteuerung/fan control kernel mod

Beitragvon Peking-Ente » 19.09.2011 11:48

Yes, it would be good to find out how to control the fan speed because my solution only provides how to turn it on and off. A good start is this acer_ec.pl script where you can dump the embedded controller register.
Peking-Ente
 
Beiträge: 21
Registriert: 15.07.2009 15:13

Re: FSC Amilo XA 3530 Lüftersteuerung Kernel Modul

Beitragvon Peking-Ente » 03.11.2011 12:46

Ich habe jetzt auch noch ein Windows Kernel Modul geschrieben und ein zusätzlichen Kühler auf die Cpu gelegt.
20111103_002.jpg

systraymenu.png
systraymenu.png (1.04 KiB) 3660-mal betrachtet
Peking-Ente
 
Beiträge: 21
Registriert: 15.07.2009 15:13

Re: FSC Amilo XA 3530 Lüftersteuerung Kernel Modul

Beitragvon Peking-Ente » 27.11.2013 03:13

Neu: Waterfan Programm für den Fujitsu-Siemens Amilo Xa 3530!

Ich habe jetzt mittlerweile meine Lüftersteuerung für Windows fertig programmiert. Hier geht es zum download:http://bit.ly/1be6G5u.
menu2.png
menu2.png (2.5 KiB) 1754-mal betrachtet
menu.png
menu.png (3.03 KiB) 1754-mal betrachtet
Peking-Ente
 
Beiträge: 21
Registriert: 15.07.2009 15:13


Zurück zu Linux / Unix / BSD