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

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

1. ### Aaron44126Notebook Prophet

Reputations:
849
Messages:
5,315
1,841
Trophy Points:
331
A command-line app that allows you to take over fan control in many Dell laptop/notebook computers.

This program is part of a suite of tools called DellFanManagement.

See the current release at: https://github.com/AaronKelley/DellFanManagement/releases
Source code available at: https://github.com/AaronKelley/DellFanManagement
Old, unmaintained C++ version is 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
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$15. 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, @maffle, and @ja14000 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

The list of systems with confirmed support can be found in this post. It should work with virtually all modern Dell laptops (with Intel Core 2nd gen / Sandy Bridge CPU or newer).

Requirements

64-bit Windows OS support only
(There are reports of BSOD with Windows 7, you might need Windows 10.)
.NET Framework 4.8
Visual C++ 2019 redistributable: https://aka.ms/vs/16/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)
test                    Try turning EC fan control off,
and record the fan RPM at different levels.
rpm-fan1                Report RPM for fan 1
rpm-fan2                Report RPM for fan 2
(RPMs are reported via status/error code)

After EC fan control is off, you may use:
fan1-level0             Set fan 1 to level 0 (0%)
fan1-level1             Set fan 1 to level 1 (50%)
fan1-level2             Set fan 1 to level 2 (100%)
fan2-level0             Set fan 2 to level 0 (0%)
fan2-level1             Set fan 2 to level 1 (50%)
fan2-level2             Set fan 2 to level 2 (100%)

Append "-alt" to EC disable or enable commands to attempt alternate method.
(Example: ec-disable-alt)
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

=====================
 - I wanted to mention that I stopped using SpeedFan to manage the fans. I'm using DellFanKeepAlive instead. But I'm leaving the SpeedFan directions here if anyone would like to see how I used to have it set up or use SpeedFan themselves.
=====================

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.

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:

"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:

(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

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 22, 2021
2. ### DanishbluntGuest

Reputations:
0
Very neat, thanks for sharing!

3. ### maffleNotebook Evangelist

Reputations:
170
Messages:
541
491
Trophy Points:
76
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. ### Aaron44126Notebook Prophet

Reputations:
849
Messages:
5,315
1,841
Trophy Points:
331
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
5. ### maffleNotebook Evangelist

Reputations:
170
Messages:
541
491
Trophy Points:
76
Will these always be executed as admin?

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

6. ### Aaron44126Notebook Prophet

Reputations:
849
Messages:
5,315
1,841
Trophy Points:
331
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.
7. ### powerslave12rNotebook Evangelist

Reputations:
0
Messages:
539
38
Trophy Points:
41
Thank you for this, I will try this out on the Precision one of these days.

8. ### cloud023Notebook Guru

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

9. ### Aaron44126Notebook Prophet

Reputations:
849
Messages:
5,315
1,841
Trophy Points:
331
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.

10. ### MikeR_VaNotebook Enthusiast

Reputations:
0
Messages:
21
4
Trophy Points:
6
My experiments so far with the 9360 suggest the following:

1. Disabling the EC will kill control with the F11/F12 keys. This can be restored in session using ClickmonitorDDC, which I like better anyway -- much more granular control.

2. If you install Clickmon, you will maintain control through modern sleep sessions IF ON AC POWER. But when I pull the plug, there's a consistent loss of control when the XPS wakes thereafter.

3. If you just kill modern sleep and treat hibernation as the new S3 sleep, you will maintain control of brightness. Of course, when I wake up from that, the print reader pretty consistently doesn't work. There's always one more glitch . . .

I should be able to fall back a couple of BIOS versions to the last one where Dell had a force S3 sleep option. I don't know if that would work better, because I've not had time to test it yet. I'd rather S3 than modern sleep anyway for my use case, so I'll likely try it at some point.

Interested to compare notes to see if this is consistent across XPS machines and generations. . . .