Closed Lorys89 closed 3 years ago
The issue seems to be due to Macs Fan Control having issues with SMC key sorting. There is a sample dump here: https://github.com/acidanthera/bugtracker/issues/1370#issuecomment-747133667
Well, the app doesn't support unsorted keys because all macs have them sorted. Why wouldn't you sort them for hackintosh?
That is due to how the plugin architecture is implemented in VirtualSMC, due to parallel access and asynchronous key addition during boot time it is not easily possible to sort them in a lock-free manner, and lock-free implementation is pretty much a requirement for MMIO SMC protocol.
From my experience with the SMC firmware reverse-engineering, as well as SMC kexts, the fact the keys are sorted is not guaranteed, and no Apple software relies on it. So far yours is the first program to have issues with this. Given how SMC works, I do not quite understand why do you need to distinguish sorted/unsorted keys in the first place. There is a GetKeyInfo functionality, allowing you to access the keys by name.
This would heavily slow down app startup on real macs - enumerating ALL keys...
Sorry, but I do not see where do you need to enumerate all the keys. The get info method is implemented in hardware. The method is exposed via KERNEL_INDEX_SMC method through the IOUserClient interface (as SMC_CMD_READ_KEYINFO). See this code as an example: https://github.com/acidanthera/VirtualSMC/blob/39dfcfbe395c9667c4869f0cb02de02519beb35e/Tools/smcread/smcread.c#L85
We can discuss the implementation details directly through e.g. iMessage if you need more info on the topic how SMC works.
Currently, the app finds ALL temperature keys (e.g. Txxx) and displays those which are valid and suitable for certain machines (iMac16,1.. etc). I'm ready to tune it for hackintosh, just two questions:
Right, I am unsure of the exact implementation in your tool, but the detection route sounds fine to me.
For VirtualSMC the SMC device has IOClass equal to VirtualSMC. I guess this is the preferred way to detect it. Real Macs do not have this key. You could find the I/O Registry dump for the reference here: https://github.com/acidanthera/bugtracker/issues/1370#issuecomment-747133667
For the SMC keys, we try to support a superset of the keys available on different Macs and do not invent our own keys. I grepped the list for you:
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTG0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','G',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTm0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','m',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTN0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','N',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTA0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','A',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTW0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','W',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCBatteryManager/SMCBatteryManager.hpp: static constexpr SMC_KEY KeyTB0T(size_t i) { return SMC_MAKE_IDENTIFIER('T','B',KeyIndexes[i],'T'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0C(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'C'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0c(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'c'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0D(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'D'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0E(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'E'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0F(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'F'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0G(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'G'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0J(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'J'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0H(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'H'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); }
VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0p(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'p'); }
For the core temperatures the indies start similar to Macs depending on the Mac model: https://github.com/acidanthera/VirtualSMC/blob/1.1.9/Sensors/SMCProcessor/SMCProcessor.cpp#L429-L464
The interesting part of some VirtualSMC plugins is that some of them use the I/O Registry interface to report values that do not have equivalence in Mac SMC keys. If you decide to support this, you can find a sample implementation in https://github.com/CloverHackyColor/HWMonitorSMC2 by searching for SMCSuperIO.
The information about different SMC keys can be found here: https://github.com/acidanthera/VirtualSMC/tree/master/Docs
Giusto, non sono sicuro dell'esatta implementazione nel tuo strumento, ma il percorso di rilevamento mi suona bene.
Per VirtualSMC il dispositivo SMC ha IOClass uguale a VirtualSMC. Immagino che questo sia il modo migliore per rilevarlo. I veri Mac non hanno questa chiave. Puoi trovare il dump del registro di I / O per il riferimento qui: acidanthera / bugtracker # 1370 (commento)
Per le chiavi SMC, proviamo a supportare un superset delle chiavi disponibili su diversi Mac e non inventiamo le nostre chiavi. Ho preso la lista per te:
VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTG0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','G',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTm0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','m',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTN0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','N',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTA0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','A',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCDellSensors/SMCDellSensors.hpp: static constexpr SMC_KEY KeyTW0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','W',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCBatteryManager/SMCBatteryManager.hpp: static constexpr SMC_KEY KeyTB0T(size_t i) { return SMC_MAKE_IDENTIFIER('T','B',KeyIndexes[i],'T'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0C(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'C'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0c(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'c'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0D(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'D'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0E(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'E'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0F(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'F'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0G(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'G'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0J(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'J'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0H(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'H'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); } VirtualSMC/Sensors/SMCProcessor/SMCProcessor.hpp: static constexpr SMC_KEY KeyTC0p(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'p'); }
Per le temperature interne gli indie iniziano in modo simile ai Mac a seconda del modello di Mac: https://github.com/acidanthera/VirtualSMC/blob/1.1.9/Sensors/SMCProcessor/SMCProcessor.cpp#L429-L464
La parte interessante di alcuni plugin di VirtualSMC è che alcuni di essi utilizzano l'interfaccia I / O Registry per riportare valori che non hanno equivalenza nelle chiavi Mac SMC. Se decidi di supportarlo, puoi trovare un'implementazione di esempio in https://github.com/CloverHackyColor/HWMonitorSMC2 cercando SMCSuperIO.
Le informazioni sulle diverse chiavi SMC sono disponibili qui: https://github.com/acidanthera/VirtualSMC/tree/master/Docs
Thank @vit9696 and thank @kleuter I am grateful to you for your commitment
@kleuter hello, news for this problem?
Maybe anyone has a piece of code that correctly detects Hackintosh, so I can use a new key enumeration approach only for Hackintosh (no plans to modify it on real macs).
Thank you!
@kleuter, we provided sample code to detect VirtualSMC here[1]. It is public domain, feel free to use as you see fit. Hope it helps ^_^
https://github.com/acidanthera/OpenCorePkg/blob/master/Utilities/acdtinfo/acdtinfo.c
@kleuter it should be very straightforward to implement this through the file I provided and we keep getting reports about the issues with your tool unfortunately. Could you please provide us with any estimates for this to land in beta? Thanks!
@vit9696 Sorry for the late reply. Any chance to have a VMware machine to test VirtualSMC sensors there?
You can surely run VSMC in VMware, but not positive about SMCSuperIO, as it requires hardware VMware cannot emulate. I think we can assign somebody from the validation team to help to execute tests for you. Will that suffice? You can PM me via imessage at the same nickname on icloud.com.
@kleuter any progress on that matter?
Will post a beta soon, I'm sorry for delays 😢
I've managed to boot catalina hackintosh on my Lenovo m720q (core i5 9400) (restored from a Time machine backup of a real catalina mac). Even using a pre-applied config, it mostly "works" though enough to compile the app. (PS)
Actually, SMC keys are sorted alphabetically on this machine: smc_output.txt
and the app displays sensors normally:
Latest VirtualSMC kext. Please let me know what to do to actually reproduce the problem.
PS. No video output on wake up. Wifi doesn't work (Intel card) but it's not an issue - I've got ethernet.
@vit9696 any help would be welcome, thanks!
@vit9696 any help would be welcome, thanks!
for catalina use this kext for wifi intel https://github.com/OpenIntelWireless/itlwm/releases/download/v2.0.0-alpha/AirportItlwm-Catalina-v2.0.0-DEBUG-alpha-33f4fbb.zip
setting misc/security - securebootmodel to Default
the problem of unseen sensors is found on "DELL" branded notebooks
I've got no Wifi with those kexts both alpha and stable (B265NGW), but it's not a big deal. My config
dev build is now able to detect VirtualSMC
[2021-05-18 17:07:14:251] [thread 81104] [app.cpp#288] Macs Fan Control 1.5.9
[2021-05-18 17:07:14:252] [thread 81104] [app.cpp#289] macOS 10.15.7
[2021-05-18 17:07:14:252] [thread 81104] [app.cpp#290] iMac19,1
[2021-05-18 17:07:14:252] [thread 81104] [app.cpp#291] Intel(R) Core(TM) i5-9400T CPU @ 1.80GHz [6 cores]
[2021-05-18 17:07:14:252] [thread 81104] [app.cpp#292] Qt 5.15.2
[2021-05-18 17:07:14:254] [thread 81104] [app_mac.mm#135] Helper installed, version - 1.0.1
[2021-05-18 17:07:14:254] [thread 81104] [app_mac.mm#150] Current version - 1.0.1
[2021-05-18 17:07:14:261] [thread 81104] [sysinfo_mac.mm#73] Hackintosh detected
[2021-05-18 17:07:14:261] [thread 81104] [sysinfo_mac.mm#82] VirtualSMC (1.2.3, published 03.05.2021, RELEASE)
dev build is now able to detect VirtualSMC
[2021-05-18 17:07:14:251] [thread 81104] [app.cpp#288] Macs Fan Control 1.5.9 [2021-05-18 17:07:14:252] [thread 81104] [app.cpp#289] macOS 10.15.7 [2021-05-18 17:07:14:252] [thread 81104] [app.cpp#290] iMac19,1 [2021-05-18 17:07:14:252] [thread 81104] [app.cpp#291] Intel(R) Core(TM) i5-9400T CPU @ 1.80GHz [6 cores] [2021-05-18 17:07:14:252] [thread 81104] [app.cpp#292] Qt 5.15.2 [2021-05-18 17:07:14:254] [thread 81104] [app_mac.mm#135] Helper installed, version - 1.0.1 [2021-05-18 17:07:14:254] [thread 81104] [app_mac.mm#150] Current version - 1.0.1 [2021-05-18 17:07:14:261] [thread 81104] [sysinfo_mac.mm#73] Hackintosh detected [2021-05-18 17:07:14:261] [thread 81104] [sysinfo_mac.mm#82] VirtualSMC (1.2.3, published 03.05.2021, RELEASE)
send the beta app preview
@kleuter you need plugins to get not alphabetically sorted keys. I.e. in addition to VirtualSMC installed you need some sensor plugin, e.g. battery, light sensor, super io, cpu, etc. Just add some of these kexts. Best to add e.g. CPUSensors.kext, they work roughly everywhere.
Speaking of Wi-Fi, I assume you have 8265NGW, not B265NGW. That should be supported. Are you sure you installed the AirportItlwm.kext and set securebootmodel to Default at the same time? Note, that all the kexts need to be specified in the config.plist explicitly in Kexts → Add section.
If you are, then use https://openintelwireless.github.io/itlwm/Troubleshooting.html and file an issue on https://github.com/OpenIntelWireless/itlwm/issues if you have time. Will help us to move forward as well.
@kleuter and your output shows that the keys are not sorted alphabetically. WKTP is the last core-provided key, then plugin keys start with PC0C.
Thanks for your feedback.
Here's the beta that should ignore sort criteria when reading SMC keys. macsfancontrol_hackintosh.zip
PS. 8265NGW, no wifi: Prelink injection AirportItlwm.kext () - Invalid Parameter (https://github.com/OpenIntelWireless/itlwm/issues/601)
Thanks for your feedback.
Here's the beta that should ignore sort criteria when reading SMC keys. macsfancontrol_hackintosh.zip
PS. 8265NGW, no wifi: Prelink injection AirportItlwm.kext () - Invalid Parameter (OpenIntelWireless/itlwm#601)
@kleuter work good now .
but if I click minimize in the menu bar, it closes. can you solve? if you want support for your hackintosh, feel free to join the telegram channel https://t.me/HackintoshLife_it
Great Job!
read this pr https://github.com/acidanthera/VirtualSMC/pull/50