Hi Matthijs!
Does this bug still affect you? There have been a lot of changes since
your bug report (switch from C to C++ amongst others). I was not able to
reproduce the error, however I don't have the exact same hardware.
Greetings,
Lee
On Sun, 12 Jul 2015 13:16:36 +0200 Matthijs Kooijman
wrote:
> Package: thinkfan
> Version: 0.9.2-1
> Severity: important
> Tags: patch
>
> Hi,
>
> while modifying my configuration to be a bit more aggressive on high
> temperatures, I found that thinkfan exited without changing the fan
> level. When started with -n, it wrote:
>
> setfan_ibm: Error writing to /proc/acpi/ibm/fan: Invalid argument
> Cleaning up and resetting fan control.
>
> I've marked this bug as important, since it causes the fan to revert to
> automatic hardware / BIOS control when the temperature is high, which is
> likely when you need the extra fanspeed from thinkfan the most. Feel
> free to downgrade if you feel this is less of an issue then I think :-)
>
> Adding a bit of debug information shows that it tried to write the
> empty string, instead of a proper fan level. It turns out that, at the
> top of the fancontrol() function, lvl_idx is initialized at the maximum
> level, but the cur_lvl variable is not changed.
>
> Normally, this is not a problem since based on the temperature, the
> index is stepped down to the appropriate level and cur_lvl is updated.
> However, if the highest level turns out to be appropriate, thinkfan
> continues to write the fan level, without updating cur_lvl.
>
> The fix is simple: Just run the set_fan macro to set cur_lvl too. This
> also means that the level is immediately made effective, which prevents
> having to wait for the watchdog timeout if the highest fanlevel is
> appropriate (which would be the effect of just setting cur_lvl instead
> of calling set_fan).
>
> --- thinkfan.c.orig 2015-07-12 13:09:28.259263201 +0200
> +++ thinkfan.c 2015-07-12 13:09:43.231401029 +0200
> @@ -111,6 +111,7 @@
>
> // Set initial fan level...
> lvl_idx = config->num_limits - 1;
> + set_fan;
>
> for (i=0; i < num_temps; i++)
> if (temps[i] > tmax) tmax = temps[i];
>
>
> Gr.
>
> Matthijs
>
> -- System Information:
> Debian Release: 8.0
> APT prefers stable
> APT policy: (990, 'stable'), (500, 'oldoldstable'), (500, 'unstable'),
> (500, 'testing'), (500, 'oldstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 4.0.2+ (SMP w/4 CPU cores)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)