Package: thinkfan
Version: 0.7.1-2
Severity: important
Tags: patch

I have a lenovo thinkpad x201. I am able to make the cpu
overheat if I run processes that are very intensive.

This is because the "level 7" fan speed (~4500RPM)
is much lower than "level disengaged" speed (~5500RPM).

It is not possible to specify explicitly in thinkfan.conf
something like:

        (disengaged, 75, 32767)

However, on my machine, I can enter disengaged mode by:

        echo level 127 >/proc/acpi/ibm/fan



thinkfan does accept the definition:

        (127, 75, 32767)

but if the temperature ever rises sufficiently so that it
gets called, it dies with the error:

        /proc/acpi/ibm/fan: Invalid argument



When I echo "level 127" directly from the commandline I do not
get this error, so I think thinkfan is actually sending some
other string.

My C is very rusty, but in system.c:setfan_ibm(), I see that
write is hardwired to be precisely 8 bytes. Won't this also
have a problem when buf contains "level disengaged" ?


I guess there are two bugs/problems:

1. It should be possible to set maximum fan speed, either by
   "level disengaged" (preferred) or something like "level 127".

2. thinkfan dies instead of just warning about this error.



A fix for the first problem seems to be to change system.c:

--- system.c    2010-06-14 00:31:18.000000000 +0100
+++ system.c.new        2011-01-21 17:50:38.000000000 +0000
@@ -83,7 +83,7 @@
        else {
                if (unlikely(cur_lvl == INT_MIN)) strcpy(buf, "level 
disengaged\n");
                else snprintf(buf, 10, "level %d\n", cur_lvl);
-               if (unlikely(write(ibm_fan, buf, 8) != 8)) {
+               if (unlikely(write(ibm_fan, buf, strlen(buf)) != strlen(buf))) {
                        showerr(IBM_FAN);
                        message(LOG_ERR, MSG_ERR_FANCTRL);
                        errcnt++;



After I recompile with this change, thinkfan no longer dies
when I use the "127" config line and the cpu gets hot, and if I
"cat /proc/acpi/ibm/fan", level is reported as "disengaged".
(This is also obvious from the increased fan volume.)


-jonathan


-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages thinkfan depends on:
hi  libc6                         2.11.2-9   Embedded GNU C Library: Shared lib

thinkfan recommends no packages.

thinkfan suggests no packages.

-- Configuration Files:
/etc/default/thinkfan changed:
START=yes
DAEMON_ARGS="-q"

/etc/thinkfan.conf changed:
(0,     0,      45)
(1,     40,     50)
(2,     45,     54)
(3,     49,     58)
(4,     53,     61)
(5,     56,     63)
(6,     58,     65)
(7,     60,     80)
(127,   75,     32767)


-- no debconf information




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to