smcFanControl icon indicating copy to clipboard operation
smcFanControl copied to clipboard

Cannot Write Values to SMC Keys

Open sidkaz opened this issue 6 years ago • 6 comments

First and foremost, thanks for making smc.c available and I'll be happy to contribute to this project (e.g., switching from OSSpinLock to os_unfair_lock).

After upgrading the internal disk of my iMac (Retina 5K, 27-inch, Late 2014), its fan runs at a higher RPM making it noisy. To slow down the fan, I am following the instructions you've provided in README but other than F0Mn it fails to write (or has no effect) for all other keys (I'm using sudo).

$ ./smc -f
Total fans in system: 1

Fan #0:
    Fan ID       : Main 
    Actual speed : 1922
    Minimum speed: 1152
    Maximum speed: 2700
    Safe speed   : -1
    Target speed : 1925
    Mode         : auto

# getting errors for all value (01, 00, 0001, 0000), showing one example:
$ sudo ./smc -k 'FS!' -w 01
Error: SMCWriteKey() = e00002bc
# apparently, there is no 'FS!' or it has no data
$ ./smc -r -k 'FS!'
  FS!   [    ]  no data

# getting no errors, but having no effect
$ sudo ./smc -k 'F0Tg' -w 0400
$ ./smc -f | grep Target
    Target speed : 1924
$ sudo ./smc -k 'F0Tg' -w 0600
$ ./smc -f | grep Target
    Target speed : 1924
$

# only works for F0Mn
$ sudo ./smc -k 'F0Mn' -w 0100
$ ./smc -f | grep Min
    Minimum speed: 64
$ sudo ./smc -k 'F0Mn' -w 1000
$ ./smc -f | grep Min
    Minimum speed: 1024

sidkaz avatar Jan 20 '19 20:01 sidkaz

I have the same issue with FS!, so the other settings are not effective.

dardo82 avatar Jun 08 '19 21:06 dardo82

I'm using 2018 Mac Mini, and the key to manually control fan speed is F0Md (from source code of smc.c) The commands in #89 may be useful to you.

wwwjfy avatar Jul 14 '19 14:07 wwwjfy

If I set the minimum speed to e.g. the double of the default minimum with

sudo smc -k 'F0Mn' -w ${$(([#16]3600<<2))/*\#}

using zsh for nested parameter expansion it actually works as expected!

I get the minimum and target speed both set at that exact value, the fan can be heard spinning up just a little bit and the actual speed is more or less that.

Fan #0:
    Fan ID       : Exhaust  
    Actual speed : 3600
    Minimum speed: 3600
    Maximum speed: 5500
    Safe speed   : 0
    Target speed : 3600
    Mode         : auto

dardo82 avatar Jul 15 '19 09:07 dardo82

There has to be a blank space in the key for forced mode: smc -k "FS! " -w 0001 After this command setting target speed has an effect.

Dirk- avatar Dec 25 '19 07:12 Dirk-

It appears that settings some keys (such as F0Mx) has no discernable effect. F0Mx does not prevent the fan exceeding that speed if FS! is true and F0Tg is set high enough though. I think at least some of them (such as F0Mx) are constantly updated by macOS, so it would overwrite any change you made.

VioletLovesJasmine avatar May 30 '20 00:05 VioletLovesJasmine

Thanks @Dirk-! It seems (only) the FS thing needs sudo (and must only be set once). WFM:

sudo /Applications/smcFanControl.app/Contents/Resources/smc -k "FS! " -w 0001
/Applications/smcFanControl.app/Contents/Resources/smc -k F0Tg -w $(printf "%x" $(echo $(($1 << 2))))

There has to be a blank space in the key for forced mode: smc -k "FS! " -w 0001 After this command setting target speed has an effect.

forthrin avatar Apr 27 '22 14:04 forthrin