Fan control on MSI laptop: no pwm-capable sensors?

12,924

I managed to have some control of the fan in Windows with the "Fan Control Tools" from Pherein, using the included GS660 profile for my MSI GS60 6QC laptop. So I made a small python script that is the Linux equivalent of Pherein's "Fan Profile Applier.exe":

#!/usr/bin/env python

import os
import sys

EC_IO_FILE="/sys/kernel/debug/ec/ec0/io"

if not os.path.exists(EC_IO_FILE):
        os.system("modprobe ec_sys write_support=1")

def ec_write(addr,value):
    with open(EC_IO_FILE,"rb") as f:
        f.seek(addr)
        old_value=ord(f.read(1))
    if (value != old_value):
        print("                %3d => %3d" % (old_value, value))
        with open(EC_IO_FILE,"wb") as f:
            f.seek(addr)
            f.write(bytearray([value]))
    else:
        print("                     = %3d" % value)

for line in open(sys.argv[1]).readlines():
    print(line.strip())
    if line.startswith(">WEC "):
        addr,value=line.split()[1:3]
        ec_write(int(addr,0), int(value,0))

Here is the input file I currently use as argument, it's the Quiet.rw file generated with Pherein's tool:

-Profile Name: Quiet
[Temperatures_1]
>WEC 0x6A 0x2f
>WEC 0x6B 0x35
>WEC 0x6C 0x43
>WEC 0x6D 0x50
>WEC 0x6E 0x5A
>WEC 0x6F 0x5F
>WEC 0x70 0x64
----
[FanSpeeds_1]
>WEC 0x72 0x00
>WEC 0x73 0x10
>WEC 0x74 0x3E
>WEC 0x75 0x45
>WEC 0x76 0x4C
>WEC 0x77 0x54
>WEC 0x78 0x5B
----
[Temperatures_2]
>WEC 0x82 0x37
>WEC 0x83 0x41
>WEC 0x84 0x4B
>WEC 0x85 0x55
>WEC 0x86 0x5A
>WEC 0x87 0x5D
>WEC 0x88 0x66
----
[FanSpeeds_2]
>WEC 0x8A 0x0
>WEC 0x8B 0x3B
>WEC 0x8C 0x46
>WEC 0x8D 0x54
>WEC 0x8E 0x5B
>WEC 0x8F 0x5B
>WEC 0x90 0x5B
----
>RwExit

With the latest EC Firmware there is actually no in between 0 RPM and 3000 RPM for fan speed.

Share:
12,924

Related videos on Youtube

ElectronWill
Author by

ElectronWill

French student. 6y+ experience with Java, actively learning Scala.

Updated on September 18, 2022

Comments

  • ElectronWill
    ElectronWill over 1 year

    I'm trying to control the fan speed of my MSI GS60-2PC laptop on Ubuntu 16.04.

    But pwmconfig reports that

    There are no pwm-capable sensors modules installed
    

    I'm pretty sure these fans can be controlled, because some utilies on Windows can control them.

    What I've done

    1. I've run sensors-detect (as root) like this:

       yes | sensors-detect
      

    It seems to only detect "coretemp". Here's the full result.

    1. Then pwmconfig (as root):

      pwmconfig
      

    And I get the famous message There are no pwm-capable sensors modules installed.

    1. I've tried the following things, which didn't work:
      • Adding to grub (and then rebooting): acpi_osi=Linux
      • Adding to grub (and then rebooting): acpi_osi=!Windows 2012
      • Adding to grub (and then rebooting): acpi_enforce_resources=lax

    What I get when I run the sensors command

    acpitz-virtual-0
    Adapter: Virtual device
    temp1:        +27.8°C  (crit = +105.0°C)
    temp2:        +29.8°C  (crit = +105.0°C)
    temp3:        +50.0°C  (crit = +100.0°C)
    
    coretemp-isa-0000
    Adapter: ISA adapter
    Physical id 0:  +48.0°C  (high = +84.0°C, crit = +100.0°C)
    Core 0:         +48.0°C  (high = +84.0°C, crit = +100.0°C)
    Core 1:         +44.0°C  (high = +84.0°C, crit = +100.0°C)
    Core 2:         +46.0°C  (high = +84.0°C, crit = +100.0°C)
    Core 3:         +44.0°C  (high = +84.0°C, crit = +100.0°C)
    

    EDIT: Here's the result of lspci.

  • ElectronWill
    ElectronWill almost 8 years
    Weird: MSI claims that this software is able to "control" the fans. How does it do if its impossible? ... Maybe it flashes the EC firmware?
  • Steve Roome
    Steve Roome almost 8 years
    @Electronwill This not application software it is a feature of the BIOS. I have updated my answer.
  • ElectronWill
    ElectronWill almost 8 years
    By "cooler boost button", do you mean this button ? It seems that I don't have such a cooler button on my GS60. This button is available on the GE60 and GE70.
  • Steve Roome
    Steve Roome almost 8 years
    Thats a pity. The manual for your laptop says its available on some models.
  • ElectronWill
    ElectronWill almost 8 years
    I wonder where you've found the manual. The official one, on the MSI website, doesn't mention any cooler button. Nor does the quick guide. Anyway, you're right about the chipset, so I'll accept your answer.
  • Steve Roome
    Steve Roome almost 8 years
    You are right. I was reading the manual for a GE60 2PE Apache Pro
  • ElectronWill
    ElectronWill almost 8 years
    Wow ! I've just tried it and the fan speed changed, even though it's not so quieter than before. I'm very interested :-) A few questions: the changes reset when the PC restarts, don't they? Does is take every sensor into account or just the CPU?
  • ElectronWill
    ElectronWill almost 8 years
    I've just found here a profile for the GS60 that seems to work better than the GX660's profile you provided! On my machine at least. Maybe you have a different firmware version that makes the GX660's profile work better? As far as I understand, the differences are the offsets: the profile I found start at 0x69, not 0x6A.
  • ElectronWill
    ElectronWill almost 8 years
    Well, eventually, the fans can be controlled by a software.