Chris911 / iStats

Ruby gem for your mac stats
http://chris911.github.io/iStats/
MIT License
2.41k stars 170 forks source link

fan speed bug on macbook pro 2018 with i9 processor #65

Closed 18o closed 6 years ago

18o commented 6 years ago

P8hUdU.png

Chris911 commented 6 years ago

I don't have access to a 2018 i9 Macbook so this might take a while to investigate.

osmszk commented 6 years ago

iMac Pro is same

$ istats
--- CPU Stats ---
CPU temp:               39.69°C     ▁▂▃▅▆▇

--- Fan Stats ---
Total fans in system:   2
Fan 0 speed:            55849552 RPM▁▂▃▅▆▇
Fan 1 speed:            7209489 RPM ▁▂▃▅▆▇

--- Battery Stats ---
No battery on system
xishec commented 6 years ago

same thing here with 2018 MacBook Pro 13 TouchBar

Chris911 commented 6 years ago

I'll try go get my hands on a 2018 Macbook to debug this issue.

Chris911 commented 6 years ago

I might have a fix but still can't test on a 2018 Macbook. If anyone is willing to try the fix locally let me know and I'll send you instructions.

xishec commented 6 years ago

im willing to try

Chris911 commented 6 years ago

Great thanks. I'm not sure if you're computer is setup for development so I'll try to include as much instructions are possible. Run all commands in your terminal.

  1. Install xcode dev tools with: xcode-select --install
  2. Clone this project locally with git clone https://github.com/Chris911/iStats.git and go to the directory cd iStats.
  3. Checkout the branch with the fix: git checkout update-fan-speed-function
  4. Build the native module with: cd ext/osx_stats && ruby extconf.rb && make && cd -
  5. Copy the bundle over to lib: cp ext/osx_stats/osx_stats.bundle lib
  6. Run iStats: ./bin/istats

Let me know if that works.

xishec commented 6 years ago

mmacbp:~ nehs$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates

mmacbp:~ nehs$ git clone https://github.com/Chris911/iStats.git Cloning into 'iStats'... remote: Counting objects: 886, done. remote: Compressing objects: 100% (4/4), done. remote: Total 886 (delta 0), reused 3 (delta 0), pack-reused 881 Receiving objects: 100% (886/886), 290.93 KiB | 1.94 MiB/s, done. Resolving deltas: 100% (447/447), done.

mmacbp:~ nehs$ cd iStats

mmacbp:iStats nehs$ git checkout update-fan-speed-function Branch 'update-fan-speed-function' set up to track remote branch 'update-fan-speed-function' from 'origin'. Switched to a new branch 'update-fan-speed-function'

mmacbp:iStats nehs$ cd ext/osx_stats && ruby extconf.rb && make && cd - creating Makefile compiling smc.c smc.c:230:21: warning: 'CFPropertyListCreateXMLData' is deprecated: first deprecated in macOS 10.10 - Use CFPropertyListCreateData instead. [-Wdeprecated-declarations] CFDataRef xml = CFPropertyListCreateXMLData(kCFAllocatorDefa... ^ /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:56:11: note: 'CFPropertyListCreateXMLData' has been explicitly marked deprecated here CFDataRef CFPropertyListCreateXMLData(CFAllocatorRef allocator, ... ^ 1 warning generated. smc.c:230:21: warning: 'CFPropertyListCreateXMLData' is deprecated: first deprecated in macOS 10.10 - Use CFPropertyListCreateData instead. [-Wdeprecated-declarations] CFDataRef xml = CFPropertyListCreateXMLData(kCFAllocatorDefa... ^ /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:56:11: note: 'CFPropertyListCreateXMLData' has been explicitly marked deprecated here CFDataRef CFPropertyListCreateXMLData(CFAllocatorRef allocator, ... ^ 1 warning generated. linking shared-object osx_stats.bundle ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib' ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib' ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib' ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib' /Users/nehs/iStats

mmacbp:iStats nehs$ cp ext/osx_stats/osx_stats.bundle lib

mmacbp:iStats nehs$ ./bin/istats --- CPU Stats --- CPU temp: 40.69°C ▁▂▃▅▆▇

--- Fan Stats --- Total fans in system: 2 Fan 0 speed: 0 RPM ▁▂▃▅▆▇ Fan 1 speed: 0 RPM ▁▂▃▅▆▇

--- Battery Stats --- Battery health: Good Cycle count: 3 ▁▂▃▅▆▇ 0.3% Max cycles: 1000 Current charge: 3472 mAh ▁▂▃▅▆▇ 70% Maximum charge: 5225 mAh ▁▂▃▅▆▇ 102.7% Design capacity: 5088 mAh Battery temp: 34.59°C

It dosent seem to work for me holp that i've done the right thing!

Chris911 commented 6 years ago

Ah bummer. Thanks for testing so quickly. I'll find someone with a 2018 macbook to debug the issue further.

18o commented 6 years ago

i have try with branch update-fan-speed-function and also got the o RPM for 2 fans

18o commented 6 years ago

i guess it's because of the T2 chip on new mac

Chris911 commented 6 years ago

I debugged the issue slightly but only had access to a 2018 Macbook for 20 minutes.. The datatype for fan speed changed from FPE2 to FLT but I didn't have time to write a fix that supports both the old and the new formats. Unfortunately I doubt I'll have access to a 2018 macbook again any time soon so I'm open to contributions.

Chris911 commented 6 years ago

Hi again, can someone with a 2018 laptop run the executable in the zip attached and post the output here. Thanks.

$./smc -l > smc_dump.txt

smc.zip

18o commented 6 years ago

smc_dump.txt

Chris911 commented 6 years ago

Thanks @johnull that's really helpful. I have another potential fix but again it's hard for me to debug so if @johnull or @nehcix you're willing to try the debug branch please go ahead. The instructions are here. If you already have the branch checked out don't forget to git pull before recompiling.

18o commented 6 years ago

thanks for your update, it seems works well

qq20180730-051913 2x
Chris911 commented 6 years ago

Great! Thanks for testing. I'll publish a new official version in a few minutes.

18o commented 6 years ago

Cheers!

Chris911 commented 6 years ago

v1.6.0 has been published with support for 2018 models. Update locally using gem install iStats. If it still doesn't work for anyone please post here and I'll reopen the issue.