3 ms·
You don't need to use a kext. You can instead use IOKit to talk to the AppleSMC driver over a Mach port. Works even without root: https://gist.github.com/vageli
by skissane 5y ago
You don't need to use a kext. You can instead use IOKit to talk to the AppleSMC driver over a Mach port. Works even without root: https://gist.github.com/vagelim/dd5be2802ecb097b81cf07711f6a5fea https://gist.github.com/vagelim/dd5be2802ecb097b81cf07711f6a...
VirtualBox has code to do the above. But it also has code in one of its kexts to do it by talking directly to the hardware, in case (for whatever reason) this API doesn't work; it tries IOKit first and then calls the kext as a fallback. And, the kext doesn't solely exist to talk to the SMC, it does a bunch of other things too. I'm not sure whether VirtualBox works without its kexts, but if it doesn't, it isn't because of this reason.
(When I wrote my original comment above, I didn't know you could do this through the IOKit API, although I've since edited that comment to mention it.)