How do you control the Apple MacBook “Sleep” light

2019-07-05 03:33发布

问题:

I would like to control the "sleep" light on a MacBook or iMac.

That is, I want to be able to make it turn on, turn off, and pulsate.

I am happy to do this in usermode or in kernel mode. I assume I'll need root.

Any ideas?

回答1:

You don't, at least not in any way that will not involve possibly bricking your machine. The sleep light is controlled (on intel macs) by the SMC, and you can't even get to it through Open Firmware.

There is hope, after a fashion, as Apple has actually released firmware updates to make the LED dimmer (on some machines it was insanely bright). You could poke around in the EFI firmware updates for the SMC that have been delivered and see if you can figure out how they control the light. However, even in that case, whatever you did would have to be done completely in firmware, as it's unlikely you can make the SMC expose that variable to software. If you pop open the case of a MacBook Pro, there's a Cypress MSA in there that is probably what is functioning as the SMC, since it's hooked into the keyboard USB and can thus wake from sleep, etc. without running the main CPU. (You can also follow the traces from the sleep light - there's a little cable attached in there if you want to remove it completely - and I suspect if you pulled the whole logic board out that you would find that it runs to that chip as well).

Of course, as I mentioned before, as soon as you start flashing your SMC, you can easily brick the machine if you screw it up.