Clevo Fan Control for Linux

Discussion in 'Sager and Clevo' started by Dennismungai, Oct 31, 2018.

  1. Dennismungai

    Dennismungai Notebook Deity

    Reputations:
    733
    Messages:
    894
    Likes Received:
    830
    Trophy Points:
    106
    Great success, glad it works for you.
     
  2. banskt

    banskt Notebook Enthusiast

    Reputations:
    0
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    6
    Thank you and props to Tuxedo for this wonderful piece of software. I made some minor changes in the source code and managed to build and run it on a Clevo P651SE bought from CEG-Hardcorecustom running the premamod BIOS. Basically, I had to bypass the check for vendor name and board / BIOS model before compiling the source code. I never had such a silent Clevo before.

    Thanks again!
     
  3. Dennismungai

    Dennismungai Notebook Deity

    Reputations:
    733
    Messages:
    894
    Likes Received:
    830
    Trophy Points:
    106
    You may want to create a pull request for that, as other Prema-mod BIOS systems may be affected by the whitelist that your patch bypasses.
     
  4. banskt

    banskt Notebook Enthusiast

    Reputations:
    0
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    6
    I do not think that is a good idea because the existing source code purposefully checks for computers from Tuxedo and their motherboard. Bypassing that is vulnerable. It is a very simple change but very risky. I would be happy to help if anyone is interested.

    See these 3 functions: isTuxedoDevice(), getDmiModelVendor() and getDmiModelName() in src/common/system.ts (https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/src/common/system.ts)
     
  5. Dennismungai

    Dennismungai Notebook Deity

    Reputations:
    733
    Messages:
    894
    Likes Received:
    830
    Trophy Points:
    106
    It's also documented.
     
  6. Dennismungai

    Dennismungai Notebook Deity

    Reputations:
    733
    Messages:
    894
    Likes Received:
    830
    Trophy Points:
    106
    Related, I have opened up an issue on the same which suggests a saner approach to this vendor check routine.
     
    hmscott likes this.
  7. debguy

    debguy rip dmr

    Reputations:
    607
    Messages:
    893
    Likes Received:
    4
    Trophy Points:
    31
    Can someone please tell me how this software technically works? I mean, what would I have to do to control the fan manually?
    For reference, in Thinkpads (e.g. T430) there is /proc/acpi/ibm/fan and I can manually set fan speeds according to [1]. What would I have to do to do the same thing on a Clevo laptop?

    I have no Clevo laptop yet, so I only skimmed the source code, but I didn't find any obvious hints like a path in /proc.
    Do I need a special kernel module to expose such an interface? The binary Ubuntu package doesn't seem to contain one.


    [1] http://www.thinkwiki.org/wiki/How_to_control_fan_speed
     
  8. qon

    qon Notebook Enthusiast

    Reputations:
    7
    Messages:
    12
    Likes Received:
    9
    Trophy Points:
    6
    Technically, the fan is controlled by writing to io ports of the EC chip.
    This is what the tuxedo utility does (https://github.com/tuxedocomputers/tuxedo-fan-control). No special kernel module is required for that (besides the standard ec_sys).
    Tuxedo has a special kernel module for controlling keyboard led: https://github.com/tuxedocomputers/tuxedo-keyboard.

    There is also a deprecated old kernel module by tuxedo (tuxedo-wmi), which has been complemented by several people over the time, but tuxedo does no longer maintain it.
    Some version also offer access to the fan control via hwmon / sysfs interface. You can check my fork here: https://github.com/davidrohr/clevo-xsm-wmi

    Another tool is https://github.com/davidrohr/clevo-indicator (check also the other forks). Some people reverse engineered a clevo windows tool that was around in the wild.
    It basically does the same as the tuxedo-tool, or the modified kernel module: writing to the ec io ports.

    Probably, sticking to the tuxedo tools for fan control and the kernel module for the keyboard is simplest.
    If you want to play around more with it, you can also check the the forks I pointed to in my github.
    Of course, everything is without any warranty.
    The most dangerous thing is: all these tools do fan control in software. They fix a certain fan speed. If you set the speed to low and run some compute intense stuff, the laptop will simply overhead. There is no safety feature for the fan speed. There is only a hard shut down once the laptop reaches a certain temperature, but that is certainly not so healthy.
     
  9. debguy

    debguy rip dmr

    Reputations:
    607
    Messages:
    893
    Likes Received:
    4
    Trophy Points:
    31
    Thanks for the info!

    Can you elaborate in that please? Does the EC chip expose an interface to the system that I could access easily - ideally via a script?
    I'm currently sitting on a Dell E6230 running Debian, where I can monitor (but not set) the fan speed via /sys/class/hwmon/hwmon1/fan_input. I believe I see something resembling this in your code under [1], but I'm not sure. (My C is very rusty.)

    That was the code I was referring to initially. I also had a look at the binary Ubuntu package under [2], but that puzzled me because to me it looks nothing like I would have expected a fan control package to look like:
    no kernel modules or dkms-related stuff, instead I see multimedia-related libs (ffmpeg, gles), a mostly empty dependency list in the control file and a "huge" binary that likely does a lot of other stuff besides reading temperatures and setting fan speeds.
    Don't get me wrong, I'm not implying anything here, but out of curiosity I like to understand what a software does - especially when it comes from a 3rd party.


    [1] https://github.com/davidrohr/clevo-xsm-wmi/blob/master/module/clevo-xsm-wmi.c
    [2] https://deb.tuxedocomputers.com/ubuntu/pool/main/t/tuxedofancontrol/
     
  10. qon

    qon Notebook Enthusiast

    Reputations:
    7
    Messages:
    12
    Likes Received:
    9
    Trophy Points:
    6
    Technically, it is an io port to which you can write in a C program when you are root. Probably, you can also do that with python or so, but I have no experience.

    This is also what the tuxedo-tool does. I think the tool is pretty large because it uses electron for the GUI. If you want something that works out of the box, this is probably still the easiest way to go.
    However, I never used it and I have no idea if you can control it with a script. Don't think it provides a file-based interface.

    If you want a file-based sysfs interface, you can only use one of the customized clevo-xsm-wmi kernel modules. (Not that this is not maintained anymore). For me it works in a clevo P775 laptop. It should also do for other models, but I never tried that.
    With the clevo-xsm-wmi module, you can monitor and set fan speeds via /sys/class/hwmon/...
     
Loading...

Share This Page