Jump to content
2,189 posts in this topic

Recommended Posts

11 hours ago, vector sigma said:

Hi guys, today I've created the "development" branch where I'll put new code from now on. What's on the new branch?

The Fan control from HWMonitorSMC2 for all kexts that support writing SMC keys, Apple or not.

 

W836x.kext (Nuvoton and Windbond chips) is highly modified and uses the NVRAM to store settings across reboots, and this is how it works:

  1. Install the FakeSMC.kext and W836x.kext from the dmg attached. Will not work with old FakeSMC.kext.
  2. To enable the Fan control you have to add the new kernel flag -fanCtrl and reboot.
  3. Use the new HWMonitorSMC2.app, always from the attached dmg.
  4. Go to the preferences and enable "Fan Control", restart the app for the changes to take effect. If you want to show min and max values you have to enable "Show Min/Max speed" as well.

FanControl.png.ffc3590a4768fe551115f7b0b97fc4f3.png

 

 

How W836x.kext knows the min and max rpms can do a fan?

Simply by calibrating them during the first attempt ever made, by slow down at minimum your fans... so it will know the minimum rpms, and so the same for the max values. Values will be saved to the NVRAM, so next times this will not happen again.

You can recalibrate fans by setting the following nvram variable to the max:


sudo nvram HW_fanControl=%ff

..and you will hear your fans slow down firstly, and then go at max for some seconds. The third stage is to restore the motherboard defaults, so that you can decide if enable the fan control for a specific fan.... directly in HWMonitorSMC2.app:

PWM.png.687869f08267b28167683f6b47c4347b.png

pay attention that you have to enable the PWM checkbox otherwise you will not be able to edit its value.

(By disabling the PWM checkbox... the fan will be in auto mode, or to be more precise how is set in the BIOS)

---------------------------------------------------------------------------------------------------------------------------

Hi,@vector sigma, I downloaded the 199 version of hwsensors, replacing the old sensor file, but did not display the fan content after rebooting into the system, even the motherboard related content is not displayed.

 

nvram and cache have been cleaned up the problem remains.

 

Switching back to the old sensor file and Fakesmc will display the fan speed and motherboard temperature.

 

I uploaded my ioieg file, please help me to see where the problem is? Thank you!

 

My motherboard sensor model

Sensors.png.20e0f7dfe92b924b3c3fb9df1d795b71.png

 

New and old contrast

905637559_-1.thumb.jpg.ab232d12e36eed853d8406c0c3bec258.jpg

 

iMacPro 1,1-Ioieg.zip

Link to comment
Share on other sites

14 hours ago, vector sigma said:

Hi guys, today I've created the "development" branch where I'll put new code from now on. What's on the new branch?

The Fan control from HWMonitorSMC2 for all kexts that support writing SMC keys, Apple or not.

 

W836x.kext (Nuvoton and Windbond chips) is highly modified and uses the NVRAM to store settings across reboots, and this is how it works:

  1. Install the FakeSMC.kext and W836x.kext from the dmg attached. Will not work with old FakeSMC.kext.
  2. To enable the Fan control you have to add the new kernel flag -fanCtrl and reboot.
  3. Use the new HWMonitorSMC2.app, always from the attached dmg.
  4. Go to the preferences and enable "Fan Control", restart the app for the changes to take effect. If you want to show min and max values you have to enable "Show Min/Max speed" as well.

FanControl.png.ffc3590a4768fe551115f7b0b97fc4f3.png

 

 

How W836x.kext knows the min and max rpms can do a fan?

Simply by calibrating them during the first attempt ever made, by slow down at minimum your fans... so it will know the minimum rpms, and so the same for the max values. Values will be saved to the NVRAM, so next times this will not happen again.

You can recalibrate fans by setting the following nvram variable to the max:


sudo nvram HW_fanControl=%ff

..and you will hear your fans slow down firstly, and then go at max for some seconds. The third stage is to restore the motherboard defaults, so that you can decide if enable the fan control for a specific fan.... directly in HWMonitorSMC2.app:

PWM.png.687869f08267b28167683f6b47c4347b.png

pay attention that you have to enable the PWM checkbox otherwise you will not be able to edit its value.

(By disabling the PWM checkbox... the fan will be in auto mode, or to be more precise how is set in the BIOS)

 

 

Warning: as you can see my CPU Fan is controllable while "Fan 0" isn't and have equal min and max values. Why? This fan is not a PWM one because only have a 3 pin connector. In Fact to be controllable fans must have 4 pins:

PWM.jpg.9b7f224136850c0728c8da08033c4e36.jpg

 

Legacy and new SMC keys

 

In 2018 Apple introduced new SMC keys that sobstitute the old "FS! ", and in new models keys are in the format of "F1Md". This latest is the default method, but you can switch back in using the old one by adding the kernel flag "-legacyFan"

 

Why the nvram to store settings?

  1. Is persistent across reboots for all the users.
  2. You don't have to save a file somewhere or install scripts and daemons.
  3. nvram saving will only be used if HW_fanControl variable is already present in nvram... in this case published by W836x.kext. If this var is not present the app will try to write smc keys directly, but it is not persistent without a daemon that save/read somewhere smc keys involved at power off and/or power on time. Also that means that in real Mac, or with other plugins, nvram will be not touched.

How other projects should be able to use the nvram variables saved by HWMonitorSMC2.app and use the same method?

  1. The driver must post the nvram variable HW_fanControl with a value in byte >= 0 (but less then 0xff). This way HWMonitorSMC2.app knows that we want to use nvram method.
  2. being able to read and parse the HW_fanControlData variable in nvram composed by 44 bytes: 
    
    // example with only one fan, Fan at index 1, and with PWM turned on
      UInt8 nvFanControls[44] = {
        0x02, 0x00, /* 16 bits, bit at index 1 enabled for fan at index 1. Value for 'FS! ' or 'F1Md'*/
        0x00, 0x00, /* UInt16 value, fan at index 0 target speed                                     */
        0x05, 0xdc, /* UInt16 value, fan at index 1 target speed, in this case  0x05dc i.e. 1500 rpm */
        0x00, 0x00, /* UInt16 value, fan at index 2 target speed                                     */
        0x00, 0x00, /* UInt16 value, fan at index 3 target speed                                     */
        0x00, 0x00, /* UInt16 value, fan at index 4 target speed                                     */
        0x00, 0x00, /* UInt16 value, fan at index 5 target speed                                     */
        0x00, 0x00, /* UInt16 value, fan at index 6 target speed                                     */
        0x00, 0x00, /* UInt16 value, fan at index 0 min speed                                        */
        0x03, 0xE8, /* UInt16 value, fan at index 1 min speed     in this case  0x03e8 i.e. 1000 rpm */
        0x00, 0x00, /* UInt16 value, fan at index 2 min speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 3 min speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 4 min speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 5 min speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 6 min speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 0 max speed                                        */
        0x07, 0xd0, /* UInt16 value, fan at index 1 max speed     in this case  0x07d0 i.e. 2000 rpm */
        0x00, 0x00, /* UInt16 value, fan at index 2 max speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 3 max speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 4 max speed                                        */
        0x00, 0x00, /* UInt16 value, fan at index 5 max speed                                        */
        0x00, 0x00  /* UInt16 value, fan at index 6 max speed                                        */
      }; // max 7 fans supported.

     

Tested only with nuvoton chips as I don't own other mobos.

 

HWSensors-3_r199.dmg.zip

 

@Slice, tell me if is ok for you.

Hi,

I think the changes are good but I have no Winbond/Nuvoton to test.

It is possible to do the same for ITE chips because Navi at past did this.

I will look if others are still good.

  • Like 1
Link to comment
Share on other sites

Hi @vector sigma thank you for latest improvement for HWSensorSMC R199

-fanCtrl flag is a boot arg parameter?

Have you tested it in new OpenCore bootloader?

It seems an invalid parameter for it

 

thank you in advance

 

Link to comment
Share on other sites

4 hours ago, fryysyd said:

 

New and old contrast

905637559_-1.thumb.jpg.ab232d12e36eed853d8406c0c3bec258.jpg

 

iMacPro 1,1-Ioieg.zip

Hi and thanks for testing. From your ioreg I'm sure W836x.kext is not even loaded so it is normal that fans didn't show up. Causes? Not sure, wrong FakeSMC version (require FakeSMC.kext v3.5.2 from the same dmg), a bug or any. Please post a DarwinDumper log with only the kernel  log (kernel buffer messages).

Link to comment
Share on other sites

1 hour ago, fabiosun said:

-fanCtrl flag is a boot arg parameter?

Yes, is what goes in Boot->Arguments in Clover and or in nvram under 'boot-args'.

 

1 hour ago, fabiosun said:

Have you tested it in new OpenCore bootloader?

no, I don't even know what is it.

 

1 hour ago, fabiosun said:

It seems an invalid parameter for it

Sorry but this is a boot argument for the kernel, not for the bootloader. You have to ensure the kext is loaded or not and the boot argument is really given. In IoRegistryExplorer.app you can simply evaluate that  by selecting IOService and scroll to the end and see if a reference to W836x exists. This to ensure the kext is really loaded.

Also I compile them using Xcode 10.2, but with the 10.11 SDK, so a possible cause is that something goes wrong with the compilation. We can ensure this looking at the kernel log (DarwinDumper).

But I also must to say that this should not be bootloader dependent.

2 hours ago, Slice said:

It is possible to do the same for ITE chips because Navi at past did this.

Sure, just I need time and testers.

2 hours ago, Slice said:

I will look if others are still good.

good!

Link to comment
Share on other sites

41 minutes ago, vector sigma said:

Yes, is what goes in Boot->Arguments in Clover and or in nvram under 'boot-args'.

 

no, I don't even know what is it.

 

Sorry but this is a boot argument for the kernel, not for the bootloader. You have to ensure the kext is loaded or not and the boot argument is really given. In IoRegistryExplorer.app you can simply evaluate that  by selecting IOService and scroll to the end and see if a reference to W836x exists. This to ensure the kext is really loaded.

Also I compile them using Xcode 10.2, but with the 10.11 SDK, so a possible cause is that something goes wrong with the compilation. We can ensure this looking at the kernel log (DarwinDumper).

But I also must to say that this should not be bootloader dependent.

Sure, just I need time and testers.

good!

Hi

@vector sigma

In clover all is fine as you can see in attachment 

Problem for now is in OpenCore bootloader for me, but maybe I have to understand better how to use in it -fanCtrl parameter

 

by the way:

OpenCore bootloader link on IM here:

https://www.insanelymac.com/forum/723-opencore/

 

Screen Shot 2019-05-27 at 11.58.13 AM.png

Link to comment
Share on other sites

1 hour ago, vector sigma said:

Hi and thanks for testing. From your ioreg I'm sure W836x.kext is not even loaded so it is normal that fans didn't show up. Causes? Not sure, wrong FakeSMC version (require FakeSMC.kext v3.5.2 from the same dmg), a bug or any. Please post a DarwinDumper log with only the kernel  log (kernel buffer messages).

 

Thank you for your reply! 

I reset the HWMonitorSMC2, then restarted the computer and it showed up. But only CPU Fan 2 has a display setting Target, CPU Fan 1 does not? My CPU cooler is connected to two fans, and both fans are PWM. How to solve it?

000.thumb.jpg.da4426ca44343ffe60772313d395298a.jpg

 

Edited by fryysyd
Link to comment
Share on other sites

5 hours ago, fryysyd said:

But only CPU Fan 2 has a display setting Target, CPU Fan 1 does not

They are just wrong values? Create a folder to your Desktop called HWBadSensors and restart the app. Show me a picture. Also I need a ioreg if possible, thanks.

3 minutes ago, jinbingmao said:

“GPU Memory Clock”  “GPU Core Clock“ 

What do you mean?:ph34r:

Link to comment
Share on other sites

6 minutes ago, vector sigma said:

他们只是错误的价值观?创建一个名为HWBadSensors的桌面文件夹, 然后重新启动应用程序。给我看一张照片 如果可能的话我也需要一个ioreg,谢谢。

你什么意思?:ph34r:

Hope to add these two

  • Like 1
Link to comment
Share on other sites

2 minutes ago, jinbingmao said:

Hope to add these two

Core Clock is already present if published by the Apple drivers, usually for NVIDIA. Doing it for every gpu in commerce is hard. Who knows

3 minutes ago, Pavo said:

Can someone link the latest build of HWMonitorSMCv2 please?

already in this page, just some posts above :).

Link to comment
Share on other sites

18 minutes ago, jinbingmao said:

ioreg -l |grep \"PerformanceStatistics\" | cut -d '{' -f 2 | tr '|' ',' | tr -d '}' | tr ',' '\n'|grep 'Temp\|Fan\|Clock\|Power'

1.thumb.png.61a8465da0ebc85c9548ed86c3f8bdc1.png

Ok, now I've understood you :angel:,. In the mean time you can try to create this two folders inside your Desktop and restart the application?

 

HWBadSensors                 HWGraphics

debug.png.475cc54af9c66905c1dca90a10fb1a9c.png

 

See if values show up and please, post a ioreg and the "HWGraphics" folder only.

 

Edited by vector sigma
typo
Link to comment
Share on other sites

10 minutes ago, vector sigma said:

好的,现在我已经了解你了  :天使:与此同时,您可以尝试在桌面内创建这两个文件夹并重新启动应用程序?

debug.png.475cc54af9c66905c1dca90a10fb1a9c.png

1.thumb.png.4351deba37ccd5f624385039b89fb5ab.png

看看是否显示值,请发布ioreg和“HWGraphics”文件夹。

 

 

11 minutes ago, vector sigma said:

好的,现在我已经了解你了  :天使:与此同时,您可以尝试在桌面内创建这两个文件夹并重新启动应用程序?

debug.png.475cc54af9c66905c1dca90a10fb1a9c.png

 

看看是否显示值,请发布ioreg和“HWGraphics”文件夹。

 

 

HWGraphics.zip

Link to comment
Share on other sites

12 minutes ago, jinbingmao said:

NO

I think that I've understood why. In the source code is written:

if let coreclock = PerformanceStatistics.object(forKey: "Core Clock(MHz)") as? NSNumber {

and looks ok, but there's an hidden character, so "Core Clock(MHz)" is not the same as "Core Clock(MHz)".  Tomorrow I'll give you a modified one. Now I need to sleep, see you.

Edited by vector sigma
Link to comment
Share on other sites

2 minutes ago, vector sigma said:

我想我明白了为什么。我的来源写道:


但是有一个隐藏的字符,因此“核心时钟(MHz)”  与“核心时钟(MHz)”不同。明天我会给你一个修改过的。现在我需要睡觉,看到你。

OK 

Link to comment
Share on other sites

6 hours ago, vector sigma said:

They are just wrong values? Create a folder to your Desktop called HWBadSensors and restart the app. Show me a picture. Also I need a ioreg if possible, thanks.

Hi,vector sigma,As you said, I created the HWBadSensors folder on my desktop, then closed and reopened the app, as follows:

X.thumb.jpg.4d811898f571e1191b7d9f4d9cf774ae.jpg

 

This is the ioieg file, please check!

iMacPro 1,1.zip

Edited by fryysyd
Link to comment
Share on other sites

×
×
  • Create New...