Jump to content

Dell monitoring by SMM and fan control


42 posts in this topic

Recommended Posts

Dell laptops and desktop can be monitored by SMM methods as mentioned is the old topic

 

I made a plugin SMIMonitor for FakeSMC in 2014 but it was 32bits and was not working. Only now I made it to be 64bits (as darkvoid did with kozleks branch) and got positive results

Снимок экрана 2019-08-08 в 5.49.04.png  

and after heating Снимок экрана 2019-08-05 в 18.44.29.png

So I have monitoring of 4 additional temperature sensors (CPU Proximity, GPU, DIMM, and Motherboard) and a CPU fan which initially stay at 0 rpm and start rotating after heating with 2882rpm.

 

Moreover I implemented a function for brave people to control fans

sudo SMC_util3 -kF0As -w2

The last digit 2 is a FAN speed you want to set

0 = Off

1 = Low

2 = High

If you have more then 1 fan then you can manage other one by choosing next key F1As, F2As etc.

 

Precaution! Writing the fan speed is dangerous and may cause a computer damage. Do this at your own risk!

Note. SMIMonitor.kext will work only with FakeSMC v3 provided with HWSensors3 in my signature.

Official release at sf.net contains SMIMonitor without write possibility.

 

Please test and report your successes and fails.

 

 

SMIMonitor.kext-110.zip

SMC_util3.zip

smcwrite.zip

  • Like 2
  • Thanks 2

Big news!

I added an ability to manually set Fan speed.

See how it works:

1. The computer is cool and the fan is stopped

Снимок экрана 2019-08-12 в 18.52.21.png

2. I set Manual Drive

sudo smcwrite F0Md 0100

and then set the fan 0 to low speed

sudo smcwrite F0As 0100

Снимок экрана 2019-08-12 в 19.01.36.png

3. Then I forced the fan to HIGH speed

sudo smcwrite F0As 0200

Снимок экрана 2019-08-12 в 19.01.57.png

OK, I need no more the high speed so I stopped the fan

sudo smcwrite F0As 0000

Or I want to give the computer automatic control on fans

sudo smcwrite F0Md 0000

 

@vector sigma

Can we add this function to HWMonitorSMC2? I see there is a template for FAN control.

What I need is to set in preferences

Temp01 - a temperature to switch fan from OFF to LOW. (default 50)

Temp12 - from LOW to HIGH (default 70)

Temp21 - from HIGH to LOW (default 60)

Temp10 - from LOW to OFF (default 40)

and a switch manual/auto.

When the Monitor checks CPU Temp it will write SMC keys as shown above.

  • Like 2
4 hours ago, Slice said:

I added an ability to manually set Fan speed.

Good!

 

4 hours ago, Slice said:

Can we add this function to HWMonitorSMC2? I see there is a template for FAN control.

Fan control is already there, only that is probably missing the "F0Tg" key(s) to know where the Fan should target the speed?

(HWMonitorSMC2 already watching for FS! and/or F0Md)

 

4 hours ago, Slice said:

What I need is to set in preferences

To store somethings in the Preferences there's a big problem, we cannot use sudo without the user to type the password, in this case when the HWMonitorSMC2 will be started... will ask for a password... for each Fans, very unpleasant. More will be for one user only as the preferences are for the current account

 

Or, write an helper tool (a brain trip.... but I can), and do what we want as root user (helper tool = a program blessed by the user admin, always running. Near to be a daemon). To do that a certificate from the key-chain must be created with private and public keys. This will break the ability for anyone to compile the project since only you (or me or both) will have the certificate to sign the binary. (A certificate is a identity of the developer, so a malicius person can make trojans and viruses using your/our identity... so why this certificate must never be shared) 

 

Or, use the NVRAM as I already done in the development branch:

 

 /*
   NVRAM Fan control, 44 bytes in total
   First 2 bytes to store 16 bits for 16 fans enabled or disabled (FS! keeping this two bytes, be aware with the endianess, or use the new F%dTg format and use the bit index),
   then 16 pair of bytes, to store target fan value in rpm.
   From index 16, other 16 pair of bytes, to store min fan value in rpm.
   From index 30, other 16 pair of bytes, to store max fan value in rpm.
   
   NVRAM is persistent.. and it is a good way to remember user settings for all the users.
   */
  UInt8 nvFanControls[44] = {
    0x00, 0x00, /* 16 bits, bit at index x enable fan at index x, if set. (data for FS! key, or any way the bit index says if fan at index x is enabled or not so you can translate the bit index to the new key F%dMd)*/
    0x00, 0x00, /* UInt16 value, fan at index 0 target speed (F0Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 1 target speed (F1Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 2 target speed (F2Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 3 target speed (F3Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 4 target speed (F4Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 5 target speed (F5Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 6 target speed (F6Ac) */
    0x00, 0x00, /* UInt16 value, fan at index 0 min speed (F0Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 1 min speed (F1Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 2 min speed (F2Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 3 min speed (F3Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 4 min speed (F4Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 5 min speed (F5Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 6 min speed (F6Mn) */
    0x00, 0x00, /* UInt16 value, fan at index 0 max speed (F0Mx) */
    0x00, 0x00, /* UInt16 value, fan at index 1 max speed (F1Mx) */
    0x00, 0x00, /* UInt16 value, fan at index 2 max speed (F2Mx) */
    0x00, 0x00, /* UInt16 value, fan at index 3 max speed (F3Mx) */
    0x00, 0x00, /* UInt16 value, fan at index 4 max speed (F4Mx) */
    0x00, 0x00, /* UInt16 value, fan at index 5 max speed (F5Mx) */
    0x00, 0x00  /* UInt16 value, fan at index 6 max speed (F6Mx) */
  }

and be Mac like.

4 hours ago, Slice said:

Temp01 - a temperature to switch fan from OFF to LOW. (default 50)

Temp12 - from LOW to HIGH (default 70)

Temp21 - from HIGH to LOW (default 60)

Temp10 - from LOW to OFF (default 40)

and a switch manual/auto.

Ok for the CPU temperature to set a limit, I can make it conditional if the user set a temperature... so just disable the bit at index x in FS! key (or write F0Tg = 0000 if that keys are used) is what the driver should understand but again HWMonitorSMC2 should do require for a password at the time a need be. Instead shouldn't be the driver itself to understand the temperature limit, by reading this limit some where (e.g. the NVRAM?)?)

Edited by vector sigma

Let it be NVRAM if you want. Can the Monitor ask for a password once saving preferences?

My Dell plugin can't use F0Mn, F0Mx, F0Tg because it is not deal with real speed. It deals with status={OFF, LOW, HIGH} which we set.

And yes it uses FS!. Bit N set mean Fan N will be controlled manually. Zero means automatic.

Anyway switch auto/manual require password?

6 hours ago, Slice said:

Anyway switch auto/manual require password?

Preferences can be saved, but then you have to write FS! to the SMC.

6 hours ago, Slice said:

Can the Monitor ask for a password once saving preferences?

Sure, but this is ok until the next reboot I guess, is the driver making this setting permanent?

 

Next week I'll try to made an helper tool (the only way) and be free in doing what ever we need.

46 minutes ago, vector sigma said:

, is the driver making this setting permanent?

No. At start the driver force automatic control. I think it is safe.

Other preferences may remain as is.

54 minutes ago, vector sigma said:

Preferences can be saved, but then you have to write FS! to the SMC.

 

Already done. The FS! key is RW.

And keys F0Mn, F0Mx are RO.

  • 3 weeks later...

Strange I found HighSierra tends to set F0Mx as UINT16 to be 26000. None of my kexts do this so it is from OS by own.

I have to rewrite plugins to use F0Mm instead of F0Mx to not interfere with OS.

6 hours ago, Slice said:

Strange I found HighSierra tends to set F0Mx as UINT16 to be 26000. None of my kexts do this so it is from OS by own.

I have to rewrite plugins to use F0Mm instead of F0Mx to not interfere with OS.

The development branch set both keys for nuvoton/windbond chips and keep values stored in nvram. Was your own test?

F0Mx and F0Mn are max/min rpm, so why in my opinion you have to write F0Tg (target) and let the others to be read-only. 

On 8/13/2019 at 6:03 AM, Slice said:

My Dell plugin can't use F0Mn, F0Mx, F0Tg because it is not deal with real speed. It deals with status={OFF, LOW, HIGH} which we set.

Some how this should be 0% = OFF, 30% = LOW (or something similar), 100% = HIGH, as the PWM.

In this project the way to monitor a lot of laptops through SMI.

 

Edited by vector sigma
59 minutes ago, vector sigma said:

Some how this should be 0% = OFF, 30% = LOW (or something similar), 100% = HIGH, as the PWM.

In this project the way to monitor a lot of laptops through SMI.

 

It is not a driver, it is an application to drive FANs but I see no list of laptops where it is possible.

1 hour ago, vector sigma said:

The development branch set both keys for nuvoton/windbond chips and keep values stored in nvram. Was your own test?

F0Mx and F0Mn are max/min rpm, so why in my opinion you have to write F0Tg (target) and let the others to be read-only. 

See the list

  F0Ac  [fpe2]  0.00  (bytes 00 00)
  F0ID  [{fds]  (bytes 00 01 00 00 43 50 55 20 46 61 6e 00 00 00 00 00)
  F0Mn  [fpe2]  2500.00  (bytes 27 10)
  F0Mm  [fpe2]  4900.00  (bytes 4c 90)
  F0As  [ui8 ]  0  (bytes 00)
  F0Md  [ui8 ]  0  (bytes 00)
  FS!   [ui16]  0  (bytes 00 00)
  TC0P  [sp78]  56.00  (bytes 38 00)
  TA0P  [sp78]  45.00  (bytes 2d 00)
  Tm0P  [sp78]  40.00  (bytes 28 00)
  TG0P  [sp78]  44.00  (bytes 2c 00)
  B0AV  [ui16]  59183  (bytes e7 2f)
  B0AC  [ui16]  256  (bytes 01 00)
  B0St  [ui16]  41024  (bytes a0 40)
  B0RM  [ui16]  12305  (bytes 30 11)
  BATP  [flag]  TRUE  (bytes 01)
  BNum  [ui8 ]  1  (bytes 01)
  BBIN  [ui8 ]  1  (bytes 01)
  CHLC  [ui8 ]  2  (bytes 02)
  AC-N  [ui8 ]  1  (bytes 01)
  AC-W  [ui8 ]  1  (bytes 01)
  ACIC  [ui16]  8192  (bytes 20 00)
  MSLD  [ui8 ]  0  (bytes 00)
  F0Mx  [ui16]  26000  (bytes 65 90)
  HI0N  [ui8 ]  18  (bytes 12)

Some SMC keys set by my kexts, by plugins of FakeSMC.

But other SMC keys are not mine:

F0Mx, HI0N are not registered by any of my kexts.

17 hours ago, Slice said:

It is not a driver, it is an application to drive FANs but I see no list of laptops where it is possible.

it has a kernel module. Here the list: https://github.com/hirschmann/nbfc/tree/master/Configs. Not sure how to read them, but looks like there are registers to work on, some Dell are there. 

 

18 hours ago, Slice said:

F0Mx, HI0N are not registered by any of my kexts.

I have no idea, but may be the DSDT induce a driver to publish these keys?

  • 2 months later...

can i use smimonitor together with acpimonitor?

i get fan from smi (but in log i got no power status), and all 8 ec temp from acpi,

only 1 thing i can not monitor, its PCH Dell 0N7TVV XPS 15 9550, i think its smm.

can i monitor it @Slice?

 

one thing though, in windows with https://github.com/AaronKelley/DellFanCmd/ i can disable EC and my brightness key not working, after enable EC with the same command without restarting, i cann control the brightness back, but with SMI monitor, i can disable EC with F0Md and brightness key not working, but after enable EC back, i still can not get the key working. i wish you know what im saying.

Edited by Regi Yassin

Yes, you can use smimonitor together with acpimonitor but I afraid it gives you same information.

If you check kernel.log for string SMI then you can see how many sensors can be obtains by smm methods.

 

I don't know what is the dependence between EC and brightness in your case. It should be checked by DSDT and kernel.log.

no, with smimonitor i only got fan reading and control with smcwrite, nothing about temp,

this code  is not shown when using smc -l, so i had to use acpimonitor, 

what about PCH Dell 0N7TVV? do you have something?

 

smimonitor log only found 2 fans, fan 0 and fan 1 with correct min and max speed, but no temp

Edited by Regi Yassin

its PCH temp, its not controlled by EC (according to HWInfo64)

here is log from SMIMonitor with code inside TEST

 

 

 


2019-11-15 14:19:09.865102+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Got sigs 44494147 and 44454c4c
2019-11-15 14:19:09.865104+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Based on I8kfan project adopted to HWSensors by Slice 2014
2019-11-15 14:19:09.865107+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Dell BIOS version=DISABLED
2019-11-15 14:19:09.865109+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Dump SMI ------------
2019-11-15 14:19:09.865447+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: POWER_STATUS: rc=0xffffffff eax=0x22a3
2019-11-15 14:19:09.887728+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 0: rc=0x0 eax=0x1
2019-11-15 14:19:09.888071+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: FN_STATUS 0: rc=0xffffffff eax=0x25
2019-11-15 14:19:09.910243+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 1: rc=0x0 eax=0x1
2019-11-15 14:19:09.910582+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: FN_STATUS 1: rc=0xffffffff eax=0x25
2019-11-15 14:19:09.911192+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 2: rc=0xffffffff eax=0xffff
2019-11-15 14:19:09.911801+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 3: rc=0xffffffff eax=0xffff
2019-11-15 14:19:09.912409+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 4: rc=0xffffffff eax=0xffff
2019-11-15 14:19:09.913018+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 5: rc=0xffffffff eax=0xffff
2019-11-15 14:19:09.917476+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 0: rc=0x0 eax=0x2c
2019-11-15 14:19:09.931467+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 1: rc=0x0 eax=0x32
2019-11-15 14:19:09.932044+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 2: rc=0x0 eax=0x2e
2019-11-15 14:19:09.932607+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 3: rc=0x0 eax=0x2c
2019-11-15 14:19:09.933173+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 4: rc=0x0 eax=0x30
2019-11-15 14:19:09.933936+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 5: rc=0x0 eax=0x2b
2019-11-15 14:19:09.934282+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: [Warning] No power status
2019-11-15 14:19:10.233711+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: found fan 0 type -1
2019-11-15 14:19:10.234323+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    min speed 2500
2019-11-15 14:19:10.235026+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    max speed 4900
2019-11-15 14:19:10.255850+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: found fan 1 type -1
2019-11-15 14:19:10.256459+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    min speed 2500
2019-11-15 14:19:10.257161+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    max speed 4900

 

Edited by Regi Yassin

You see at least 6 temperatures

2019-11-15 14:19:09.917476+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 0: rc=0x0 eax=0x2c
2019-11-15 14:19:09.931467+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 1: rc=0x0 eax=0x32
2019-11-15 14:19:09.932044+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 2: rc=0x0 eax=0x2e
2019-11-15 14:19:09.932607+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 3: rc=0x0 eax=0x2c
2019-11-15 14:19:09.933173+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 4: rc=0x0 eax=0x30
2019-11-15 14:19:09.933936+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 5: rc=0x0 eax=0x2b

 

yes, but its not registered, 

maybe because of this code

for (int i=0; i<6; i++) {
    rc = i8k_get_temp(i);
    if (rc >= 0) {
      int type = i8k_get_temp_type(i);
      if ((type >= I8K_SMM_TEMP_CPU) && (type <= I8K_SMM_TEMP_OTHER)) {
        TempSensors[type] = i;
        InfoLog("sensor %d type %d", i, type);
        addSensor(getKeyForTemp(type), TYPE_SP78, 2);
      }
    }
  }
Edited by Regi Yassin

Where is output from this cycle?

 for (int i=0; i<6; i++) {
    rc = i8k_get_temp(i);
    if (rc >= 0) {
      int type = i8k_get_temp_type(i);
      if ((type >= I8K_SMM_TEMP_CPU) && (type <= I8K_SMM_TEMP_OTHER)) {
        TempSensors[type] = i;
        InfoLog("sensor %d type %d", i, type);
        addSensor(getKeyForTemp(type), TYPE_SP78, 2);
      }
    }
  }

 

Can you put the line

InfoLog("sensor %d type %d", i, type);

before IF()?

there is no output, here is the output if I remove the if statement

but still no registered temp in HWMonitorSMC2 and also istatmenus, is there anything I should do to register the key?

 

2019-11-15 15:52:44.859513+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Got sigs 44494147 and 44454c4c
2019-11-15 15:52:44.859516+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Based on I8kfan project adopted to HWSensors by Slice 2014
2019-11-15 15:52:44.859519+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Dell BIOS version=regae
2019-11-15 15:52:44.859520+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: Dump SMI ------------
2019-11-15 15:52:44.859860+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: POWER_STATUS: rc=0xffffffff eax=0x69
2019-11-15 15:52:44.882147+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 0: rc=0x0 eax=0x1
2019-11-15 15:52:44.882488+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: FN_STATUS 0: rc=0xffffffff eax=0x25
2019-11-15 15:52:44.910521+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 1: rc=0x0 eax=0x1
2019-11-15 15:52:44.910862+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: FN_STATUS 1: rc=0xffffffff eax=0x25
2019-11-15 15:52:44.911507+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 2: rc=0xffffffff eax=0xffff
2019-11-15 15:52:44.912121+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 3: rc=0xffffffff eax=0xffff
2019-11-15 15:52:44.912719+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 4: rc=0xffffffff eax=0xffff
2019-11-15 15:52:44.913329+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_FAN 5: rc=0xffffffff eax=0xffff
2019-11-15 15:52:44.917788+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 0: rc=0x0 eax=0x29
2019-11-15 15:52:44.918328+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 1: rc=0x0 eax=0x2a
2019-11-15 15:52:44.918894+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 2: rc=0x0 eax=0x28
2019-11-15 15:52:44.919452+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 3: rc=0x0 eax=0x2b
2019-11-15 15:52:44.920020+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 4: rc=0x0 eax=0x29
2019-11-15 15:52:44.930588+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: GET_TEMP 5: rc=0x0 eax=0x25
2019-11-15 15:52:44.930953+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: [Warning] No power status
2019-11-15 15:52:45.234511+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: found fan 0 type -1
2019-11-15 15:52:45.235086+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    min speed 2500
2019-11-15 15:52:45.235788+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    max speed 4900
2019-11-15 15:52:45.252420+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: found fan 1 type -1
2019-11-15 15:52:45.253030+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    min speed 2500
2019-11-15 15:52:45.253725+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor:    max speed 4900
2019-11-15 15:52:45.257413+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 0 type -1
2019-11-15 15:52:45.258632+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 1 type -1
2019-11-15 15:52:45.259848+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 2 type -1
2019-11-15 15:52:45.261067+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 3 type -1
2019-11-15 15:52:45.265651+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 4 type -1
2019-11-15 15:52:45.266864+0700  localhost kernel[0]: (SMIMonitor) SMIMonitor: sensor 5 type -1

 

Edited by Regi Yassin
×
×
  • Create New...