DellFanCmd – Tool to enable manual/custom control of the laptop fans

Discussion in 'Dell' started by Aaron44126, Jan 21, 2019.

  1. Aaron44126

    Aaron44126 Notebook Virtuoso

    Reputations:
    691
    Messages:
    3,442
    Likes Received:
    866
    Trophy Points:
    181
    A command-line app that allows you to take over fan control in many Dell laptop/notebook computers.

    See the current release at: https://github.com/AaronKelley/DellFanCmd/releases
    Source code available at: https://github.com/AaronKelley/DellFanCmd

    This project uses the SMM I/O driver developer by 424778940z and is derived from the "Dell fan utility" GUI app, also by 424778940z.
    https://github.com/424778940z/bzh-windrv-dell-smm-io
    https://github.com/424778940z/dell-fan-utility
    There is prior discussion of these tools as well as development chatter about this tool in this thread:
    http://forum.notebookreview.com/thr...ol-fans-on-dell-laptops-under-windows.805317/

    424778940z's tools seem to be derived from Linux work done on fan control, including the "i8k" driver, and these projects:
    https://github.com/clopez/dellfan
    https://github.com/TomFreudenberg/dell-bios-fan-control

    Note: I am interesting in offsetting the cost of the certificate used to sign the driver, which was $75. I have already received donations, and the remaining amount is $25. I will remove this line once the cost has been offset. If you have found this tool helpful and would like to consider chipping in a few bucks, send me a PM. Thanks to @MikeR_Va and @maffle for contributions so far.

    This tool basically just allows you to tell the EC (embedded controller) in the laptop to let go of fan control. Once this is done, a tool like SpeedFan or Hwinfo64 can be used to control the laptop fans. You can set up your own temperature thresholds for fan behavior based on your own preferences.

    Note that without the EC controlling the fans, only three fan levels are available, which I will call "0%", "50%", and "100%". Some systems have more granular fan control while the EC is in charge, but you cannot change the behavior other than picking a thermal profile in Dell Power Manager. Also note that the fans' actual maximum speed may be higher than what you get if you set the speed to "100%". For example, in the Precision 7530, setting the speed to "100%" puts the fans at 4200 RPM, but if the EC is in charge of the fans and the system is under load it may push the fans up to 4800 RPM.

    Supported systems

    We have confirmation that this method works with these systems. (Add yours in a comment below and I will add it to this list.) I think that it is highly likely to work with any system closely related to these.

    Precision M4600 / Precision M6600
    Precision M4700 / Precision M6700
    Precision 7530 / Precision 7730

    Precision 5520

    Latitude E6540

    Inspiron 5379
    Inspiron 5577

    Inspiron 7559
    Inspiron 7567
    Inspiron 7577

    Inspiron 7779 ("2-in-1")

    G5 5587
    G7 7588

    XPS 9360
    XPS 9550
    XPS 9560
    XPS 9570 (BIOS 1.6.0 or lower?)
    Note: Some XPS systems seem to lose the ability to control the screen brightness from the keyboard after disabling EC fan control

    Requirements

    64-bit Windows OS support only
    (There are reports of BSOD with Windows 7, you might need Windows 10.)
    If you get a DLL missing error when running the app, try installing the Visual C++ 2017 redistributable: https://aka.ms/vs/15/release/vc_redist.x64.exe

    This guide assumes you are at least a little bit command-line savvy. If you'd rather use a GUI app, you can use the one from the original thread. Replacing bzh_dell_smm_io_x64.sys with the version from the DellFanCmd download will allow it to run without test signing mode enabled. (You still will need to make the registry change mentioned below.)

    Initial setup

    I purchased a digital code-signing certificate to sign the Dell SMM I/O driver by 424778940z so that "test signing mode" or the "disable driver signature enforcement" option is not required. However, because the driver does not have an EV certificate from Microsoft, it will not load if UEFI secure boot is enabled so you must take additional steps. The easiest way is to apply this registry change:
    Code:
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CI\Policy]
    "UpgradedSystem"=dword:00000000
    You must reboot your system before the change will take effect.

    Additional information and possible alternate solutions can be found here:
    https://www.geoffchappell.com/notes/security/whqlsettings/index.htm

    Note that this creates a minor security risk. This will allow any signed driver to be loaded, even if it does not have an EV certificate from Microsoft. Note that Microsoft did not start requiring EV certificates until Windows 10 1607 ("Anniversary Update") in mid 2016.

    Once this is taken care of, you can pass one of these options to DellFanCmd to tell it what you would like it to do.
    Example:
    Code:
    DellFanCmd.exe ec-disable
    This will tell the EC to let go of fan control and set the fans to run at "100%" (until your fan management tool takes over). You should immediately be able to control the fans with SpeedFan at this point.

    Code:
    DellFanCmd.exe ec-enable
    This will tell the EC to take over fan control again.

    Note: DellFanCmd.exe must be run elevated / "as administrator".

    Code:
    Available commands:
      ec-disable              Turn EC fan control off (fan goes to manual control)
      ec-disable-nofanchg     Turn EC fan control off and don't change the fan speed
      ec-enable               Turn EC fan control on (fan goes to automatic control)
      ec-disable-alt          Turn EC fan control off, alternate method
      ec-disable-alt-nofanchg Turn EC fan control off and don't change the fan speed, alternate method
      ec-enable-alt           Turn EC fan control on, alternate method
    The purpose and behavior of the "alternate method" is unknown to me but it might help if you find that the "regular" method does not work. The projects linked above have reference to it so I kept it in.
    Edit — One user reports being locked to a low CPU clock speed with the "regular" method, but not with the "alternate" method

    When you disable EC control of the fans, this appears to stick past reboots (unless you go into the BIOS setup and make a change). To restore everything back to the original state, you must fully shut down the system.

    SpeedFan configuration

    SpeedFan has some documentation on setting up a fan control profile here: http://www.almico.com/sfarticle.php?id=5

    The key thing to realize here is that even though you can adjust the PWM on a spectrum from 0% to 100%, the fan will actually only run at one of three speeds ("0%", "50%", and "100%"). So setting up a nice graceful fan curve won't benefit you at all. What you need to do is decide at which temperature levels you would like the fan to run at which of the three speeds.

    To get started with the SpeedFan setup:

    Go to "Configure" and then "Options" and then "Enable DELL support". Hit "OK" and then fully exit and restart the program. You should now be able to see the current fan level on the main screen, and even adjust the fans by changing the Pwm values on the main screen.

    Click "Configure" again. On the "Temperatures" tab, uncheck any temperatures that you are not interested in. For the remaining ones, click them and change the "warning" temperature to be very high (90 or 100 °C). The reason for this is, once automatic fan control is turned on, it will automatically set all of the fans to 100% if any of the "warning" thresholds are hit, regardless of the fan configuration that you have set up.

    Go to the "Fan Control" tab and check the box for "Advanced fan control". Then, add a fan controller. You will want one fan controller for each fan and you can name them appropriately. I first set this up on the Precision M6700, which has one fan clearly intended to be the CPU fan and the other clearly intended to be the GPU fan, so I named the controllers accordingly.

    [​IMG]

    For each controller, make sure to check the "Controlled speed" box (or it will do nothing) and then select which fan you would like it to control from the drop-down. Set the "Method" to "MAX of speeds" and not "SUM of speeds".

    Then you can "Add" temperature sensors and specify how you want the fan to behave for each one. With "MAX of speeds", if any of the thresholds that you set trigger, then it will run the fans at that level. I wanted to have it run the CPU fan at "50%" all of the time, unless the temperature hits 85 °C, and then it will kick it up to "100%", so the curve for each of my CPU temperature sensors looks like this:

    [​IMG]

    "Hysteresis" is a second threshold to prevent the fans from constantly changing speeds if the temperature is right around a threshold. Basically, with this configuration, the fans will go to "100%" if a CPU core reaches 85 °C, and then it won't go back down to "50%" until the temperature drops to 70 °C (a drop of 15 °C).

    (Because there is also a heat pipe from the GPU to the CPU fan, I have a sensor there to kick the CPU fan up to max if the GPU temperature exceeds 90 °C, which doesn't happen under regular use.)

    For the GPU fan, I wanted it to sit at "0%" until the GPU temperature reaches 65 °C. Then, it runs at "50%" until the temperature reaches 85 °C, and higher than that it will run at "100%". So, the fan curves look like this:

    [​IMG]

    [​IMG]

    (You could do this with a single curve but it is hard to be precise with the temperatures that way.)

    Once you have everything set up, you can go back to the main window and check the "Automatic fan speed" checkbox, and SpeedFan should take over fan control according to the options that you have set. You can make further changes under "Advanced fan control" and they will be applied as soon as you hit "OK".

    I recommend checking the "Minimize on close" option under the Options tab in "Configure", so that SpeedFan will just run in the tray after you close it and do its job in the background.

    Automatic integration

    This is my goal here:

    When you log into Windows, SpeedFan should fire automatically, and then the EC should be asked to let go of fan control so that SpeedFan can manage it. This should persist for your whole session. If you log out or reboot the system, fan control should go back to the EC because SpeedFan won't be managing the fans anymore. I set up three tasks in Task Scheduler for this.

    1. Disable EC fan control at login.
    I made a task with "At log on" of "specific user" (myself). It runs this script.
    Code:
    @ECHO OFF
    
    ECHO Waiting for SpeedFan...
    START "" /B "C:\Program Files (x86)\SpeedFan\speedfan.exe"
    sleep 75
    DellFanCmd.exe ec-disable
    pause
    This basically starts SpeedFan, waits 75 seconds (plenty of time for it to load all of the sensors and get ready to go), and then disables EC fan control. SpeedFan takes over right away. I have SpeedFan configured to start minimized.
    Note, the "sleep" command is not built in to Windows. You can get it by installing the Windows Server 2003 resource kit. https://www.microsoft.com/en-us/download/details.aspx?id=17657
    The "pause" command just adds a "press any key to continue" prompt before the command window goes away. So, I can see the output of DellFanCmd before it automatically disappears.

    The solution survives sleep but it does not survive hibernate. So...
    2. Disable EC fan upon resume from hibernate.
    I made a task with "On an event" trigger. It is set to run only if I am already logged in. The event is, Log: System, Source: Kernel-Power, Event ID: 107. It just runs: DellFanCmd.exe ec-disable
    (SpeedFan is already running.)

    3. Return fan control to the EC upon logout.
    The trickiest one. There's no clear event to trigger off of for logout. Also, I want to make sure that it is only when *I* log out and not other users (I'm not the only one who uses my laptop).

    I ended up with this. A task set to run "whether or not I am logged in", with a custom event filter trigger:
    Code:
    <QueryList>
      <Query Id="0" Path="System">
        <Select Path="System">
            *[System[Provider[@Name='Microsoft-Windows-Winlogon'] and (EventID=7002)]]
            and
            *[EventData[Data[@Name='UserSid'] and (Data='S-1-5-21-1686773459-1707497739-4133313906-1001')]]
        </Select>
      </Query>
    </QueryList>
    This captures a logout event entered by Microsoft's Windows telemetry service. The Data='S.....' is my Windows account SID. You'll have to adjust it for your own SID.
    It just runs: DellFanCmd.exe ec-enable

    I also added this to the "Shutdown script" (gpedit → Windows settings → Scripts) because the scheduled task will (sometimes?) fail when the system is shutting down or rebooting.

    When setting up scheduled tasks, pay attention to the option that is enabled by default which prevents them from running if the system is on battery power. All tasks need to be set to run with "highest privileges".


    That is all. Let me know how it works for you, and let me know if you have any suggestions/tips and I may integrate them into this post.
     
    Last edited: Apr 14, 2019 at 11:20 AM
  2. Danishblunt

    Danishblunt Guest

    Reputations:
    0
    Very neat, thanks for sharing!
     
  3. maffle

    maffle Notebook Evangelist

    Reputations:
    58
    Messages:
    355
    Likes Received:
    231
    Trophy Points:
    56
    Can confirm it dosnt work properly anymore bios >= 1.7.0 on the 9570. So I will stay on 1.6.0 (forever?), where it works awesome so far. You have a paypal? I would donate $10 to the certificate bucket even my bank account is in minus :)
     
  4. User32

    User32 Notebook Evangelist

    Reputations:
    38
    Messages:
    525
    Likes Received:
    109
    Trophy Points:
    56
    This BSoD'ed my M6500 with 0x07e and something related to the fan control driver. I did have HWiNFO's fan control open however.

    What gives?

    EDIT: Even without HWiNFO open it BSoD's my Precision if I do ec-disable.
     
  5. Aaron44126

    Aaron44126 Notebook Virtuoso

    Reputations:
    691
    Messages:
    3,442
    Likes Received:
    866
    Trophy Points:
    181
    I haven't experienced any BSOD while working on this.

    Can you run BlueScreenView and take a screen shot with the memory dump created when your BSOD happened selected? (Try to get as many columns on the screen as you can)

    I believe that the M6500 is older than any systems that I have on the confirmed working list. I'm sure that there is a lower-bound to support, and maybe you found it...
     
    Last edited: Jan 21, 2019
  6. maffle

    maffle Notebook Evangelist

    Reputations:
    58
    Messages:
    355
    Likes Received:
    231
    Trophy Points:
    56
    Will these always be executed as admin?

    https://i.imgur.com/SIRTvMU.png so that is enough?
     
  7. Aaron44126

    Aaron44126 Notebook Virtuoso

    Reputations:
    691
    Messages:
    3,442
    Likes Received:
    866
    Trophy Points:
    181
    These will be run as admin. Actually I'm not sure if calling the .exe file like that will work (I suspect it will...). Mine is actually running a batch file that sends the text output to a file so I can check to see what happened...

    Code:
    @ECHO OFF
    
    REM Make sure that we are in the right place.
    C:
    cd C:\Full\path\to\DellFanCmdFileLocation
    
    REM Hand fan control back to the EC.
    DellFanCmd.exe ec-enable > DellFanCmd-Stop-Output.txt 2>&1
     
    maffle likes this.
  8. powerslave12r

    powerslave12r Notebook Evangelist

    Reputations:
    0
    Messages:
    519
    Likes Received:
    37
    Trophy Points:
    41
    Thank you for this, I will try this out on the Precision one of these days.
     
  9. cloud023

    cloud023 Notebook Guru

    Reputations:
    9
    Messages:
    74
    Likes Received:
    36
    Trophy Points:
    26
    Losing brightness control on a 9560 via keyboard when enabled. Works again when disabled
     
  10. Aaron44126

    Aaron44126 Notebook Virtuoso

    Reputations:
    691
    Messages:
    3,442
    Likes Received:
    866
    Trophy Points:
    181
    This has also been confirmed occurring on a 9360. I don't have any XPS machines so I can't even begin to investigate. Though, it seems that the EC must be involved in brightness control and disabling EC fan control also disables this feature.

    Not sure if trying the "alternate" method would help?

    It's a hassle but I understand that you can get brightness control back by simply rebooting. EC fan control will remain disabled.
     
Loading...

Share This Page