Fedora Linux Support Community & Resources Center
  #1  
Old 9th January 2010, 08:39 PM
tkalfaoglu Offline
Registered User
 
Join Date: Oct 2007
Posts: 300
linuxfedorafirefox
ASUS M51VA Fan: Can no longer adjust it

I had the enclosed code (setfan.sh) running in the background to control the fan speed of my laptop's fan under Fedora 11. However, recently the fan.c started giving segmentation fault - it seems the changed kernel has done something to it. I tried re-compiling it of course. it did not help. Before, the laptop's fan would change speeds depending on the CPU temperature, but now I had to leave it at "auto" , which is, on all the time, at some fixed (high) speed.
The current setup is ugly - it's loud and wastes battery.

Does anyone know of a better solution?

Thanks!
-turgut

fan.c:
Code:
#include <stdio.h> // printf
#include <stdlib.h> // atoi
#include <stdint.h> // uint8_t, uint16_t
#include <string.h> // strcmp
#include <sys/io.h> // inb, outb
// IO ports
const uint16_t AEIC = 0x025D; // command register
const uint16_t AEID = 0x025C; // data register
// waits for the status bit to clear, max 0x4000 tries
void WEIE() {
	uint16_t Local0 = 0x4000;
	uint8_t Local1 = inb(AEIC) & 0x02;
	while(Local0 != 0 && Local1 == 0x02) {
		Local1 = inb(AEIC) & 0x02;
		Local0--;
	}
}
// sets the fan speed
void WMFN(uint8_t Arg0) {
	WEIE();
	outb(0x98, AEIC);
	WEIE();
	outb(Arg0, AEID);
	WEIE();
}
setfan.sh:
Code:
#!/bin/sh
OLD_SPEED="0"
OLD_TEMP="0"
setSpeed () {
	if [ "$1" != "$OLD_SPEED" ]; then
		echo "new speed   $1"
		OLD_SPEED="$1"
		/usr/local/bin/fan "$1" > /dev/null
	fi
}
while [ 1 ]; do
	TEMP=`cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2}'`
	if [ "$TEMP" != "$OLD_TEMP" ]; then
		echo "temperature $TEMP C"
		OLD_TEMP="$TEMP"
	fi

	if [ $TEMP -gt 65 ]; then
		setSpeed auto
	elif [ $TEMP -gt 60 ]; then
		setSpeed 13
	elif [ $TEMP -gt 55 ]; then
		setSpeed 11
	elif [ $TEMP -gt 50 ]; then
		setSpeed 9
	else
		setSpeed 1
	fi
	sleep 2
done
Reply With Quote
  #2  
Old 22nd April 2010, 09:15 AM
tkalfaoglu Offline
Registered User
 
Join Date: Oct 2007
Posts: 300
linuxfedorafirefox
Re: ASUS M51VA Fan: Can no longer adjust it

bump?
bump?
Reply With Quote
  #3  
Old 22nd April 2010, 10:57 AM
BugRocks1 Offline
Registered User
 
Join Date: Jan 2010
Posts: 894
linuxfedorafirefox
Re: ASUS M51VA Fan: Can no longer adjust it

Have you tried lmsensors?

http://wiki.archlinux.org/index.php/Fan_Speed_Control
Reply With Quote
  #4  
Old 20th May 2010, 10:15 AM
tkalfaoglu Offline
Registered User
 
Join Date: Oct 2007
Posts: 300
linuxfedorafirefox
Re: ASUS M51VA Fan: Can no longer adjust it

Thanks. Sensors-detect does not find any fans installed..
Reply With Quote
  #5  
Old 20th May 2010, 05:58 PM
BugRocks1 Offline
Registered User
 
Join Date: Jan 2010
Posts: 894
linuxfedorafirefox
Re: ASUS M51VA Fan: Can no longer adjust it

Here is a great FAQ about those issues.

http://www.lesswatts.org/projects/acpi/debug.php

It shows some boot parameters that you could use for debbuging and trying to find out the source of the problem.

Quote:
Thermal Issues

If the fan is spinning too much, or the system still gets hot when the fan is spinning fast:

* If the system is a laptop, most times this means that there is dust blocking the air flow from the fan over the heat-sink.
o Clean out the air vents.
o Some people find that blowing compressed air through the air vents helps.
* If you build your own system:
o Verify that you used thermal grease on the heat-sink.
o Verify that it is securely attached.

Does the same issue happen with and without "acpi=off"?

If yes, then Linux ACPI is not related to the failure.

Does ACPI control the fan on this system?

Virtually no desktops or servers use ACPI fan control. Instead, they use an embedded controller or other hardware on the motherboard that is independent of ACPI.

Note that sometimes you can view and control this hardware with BIOS SETUP. Some systems, for example, run all fans at maximum speed by default and require you to enable fan speed control in SETUP.

From Linux, you may be able to view and sometimes control native fan speed control with CONFIG_HWMON=y and the appropriate drivers sensors sub-system. Note, however, that some machines have conflicts between CONFIG_HWMON and CONFIG_ACPI because they may access the same underlying hardware using two different methods.

Most notebooks also use native fan control instead of ACPI. There are, however, a couple of notable exceptions: HP/Compaq, Acer, and Fujitsu-Siemens often use ACPI-based fan-control.

If /proc/acpi/fan is empty and /proc/acpi/thermal_zone/*/trip_points has no active trip points (those starting with "AC") then there is no ACPI-based fan control on your system.

If you have dis-assembled the DSDT, you can also check if the device "PNP0C0B" is present. That is the standard identifier for a fan device.
ps: There are more boot options on the FAQ.

There are more parameters that you could find in:

http://www.mjmwired.net/kernel/Docum...parameters.txt.

There are some places where people understand what is going on.

Notes:
[quote]Where and how to report ACPI problems and ask questions.

http://www.lesswatts.org/projects/acpi/bugzilla.php
http://www.lesswatts.org/projects/ac...ling-lists.php[/quotes]

Software:

∘ acpidump - Fedora package: pmtools
∘ acpixtract - Fedora package: pmtools
∘ iasl - Fedora package: iasl

You can dump the ACPI tables for reporting purposes with:

Quote:
su -
acpidump --output /home/[user here]/Desktop/acpi_dump


---------- Post added at 08:35 AM CDT ---------- Previous post was at 08:29 AM CDT ----------

To disassemble the DSDT to look for the fan, get the acpidump output and issue:

Quote:
$ acpixtract -a /home/[user here]/Desktop/acpi_dump
The use the DSDT:

Quote:
$ iasl -d /home/[user here]/Desktop/DSDT.dat
Now you will have a DSDT.dsl file in the Desktop hopefully, that is the asl source code which you can look for the fan name.

except for iasl the other 2 may already be installed in your system.

---------- Post added at 08:55 AM CDT ---------- Previous post was at 08:35 AM CDT ----------

Almost forgot, booting from the earlier kernel have the same issue?

If it does not you can do a diff on the entire acpi source code and see what is different, it helps a lot.

---------- Post added at 08:58 AM CDT ---------- Previous post was at 08:55 AM CDT ----------

Another great FAQ.

http://www.columbia.edu/~ariel/acpi/acpi_howto.txt
Reply With Quote
  #6  
Old 20th May 2010, 07:16 PM
tkalfaoglu Offline
Registered User
 
Join Date: Oct 2007
Posts: 300
linuxfedorafirefox
Re: ASUS M51VA Fan: Can no longer adjust it

Thank you very much for those pointers.

For me, the CPU scaling works, backlight changing works, it's only the fan..

With some kernels, the "fan" code I pasted above works well, and it can set the fan speed.
With the current kernel ( 2.6.30.10-105.2.23.fc11.x86_64 ) , the fan command gives a segmentation fault, and the /var/log/messages shows

May 20 18:46:38 tklaptop kernel: fan[27335] general protection ip:4005f4 sp:7fff83ad6888 error:0 in fan[400000+1000]


The default, if I do not muck with the "setfan.sh" and "fan.c" , is that the fan stays at full speed, loud and wastes battery.

I just wish my setfan.sh worked all the time

-turgut

---------- Post added at 10:10 AM CDT ---------- Previous post was at 10:04 AM CDT ----------

ACPI dumping gave some errors, and the mentioned file does not exist, that I suppose to give to iasl:

Code:
[root@tklaptop ~]# acpidump --output /home/turgut/Desktop/acpi_dump
Wrong checksum for ATKG
Wrong checksum for ATKG!
[root@tklaptop ~]# acpixtract -a /home/turgut/Desktop/acpi_dump 
Acpi table [DSDT] - 46656 bytes written to DSDT.dat
Acpi table [FACS] - 64 bytes written to FACS.dat
Acpi table [FACP] - 244 bytes written to FACP1.dat
Acpi table [APIC] - 92 bytes written to APIC.dat
Acpi table [MCFG] - 60 bytes written to MCFG.dat
Acpi table [SLIC] - 374 bytes written to SLIC.dat
Acpi table [ECDT] - 84 bytes written to ECDT.dat
Acpi table [DBGP] - 52 bytes written to DBGP.dat
Acpi table [BOOT] - 40 bytes written to BOOT.dat
Acpi table [OEMB] - 113 bytes written to OEMB.dat
Acpi table [HPET] - 56 bytes written to HPET.dat
Acpi table [DMAR] - 264 bytes written to DMAR.dat
Acpi table [ATKG] - 32804 bytes written to ATKG.dat
Acpi table [SSDT] - 1264 bytes written to SSDT.dat
Acpi table [XSDT] - 132 bytes written to XSDT.dat
Acpi table [FACP] - 132 bytes written to FACP2.dat
Acpi table [RSDT] - 84 bytes written to RSDT.dat
Acpi table [RSDP] - 36 bytes written to RSDP.dat
[root@tklaptop ~]#


---------- Post added at 10:16 AM CDT ---------- Previous post was at 10:10 AM CDT ----------

Update: In fact, it's erratic. the fan.c may work at boot time and then fail later on.
Or it may work great after a reboot. Currently it is working.. very odd.. -t
Reply With Quote
Reply

Tags
adjust, asus, fan, longer, m51va

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASUS M51VA: Fan always on tkalfaoglu Hardware & Laptops 2 31st August 2009 11:46 AM
ASUS M51VA: Very Low Sound on Microphone tkalfaoglu Hardware & Laptops 2 1st March 2009 08:04 AM
Weird typing problem on Asus M51VA tkalfaoglu Hardware & Laptops 3 13th January 2009 05:21 PM
CDROM issues on ASUS M51VA tkalfaoglu Hardware & Laptops 1 17th December 2008 04:34 AM
Asus M51VA: Firewire not detected tkalfaoglu Hardware & Laptops 0 12th December 2008 10:08 AM


Current GMT-time: 21:08 (Monday, 01-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat