How to catch a power button press hardware event?

Hello everyone again!


I have an issue, it implies that I want to know if there's a location in my Mac where a kernel log with the power button pressed event is hosted. I know that in Ubuntu with acpi it's easy to know when the power button was pressed because that action is logged to some accesible path. However in Mac I've searched for almost 3 weeks with no luck. I've started to think out of the box and trying to connect it with some external hardware to catch the action, but as the Mac will be powered off when the event occurs, maybe I won't be able to register the information or it will be lost in the meantime the Mac is powering on.


The reason of using a log to know that power event happened it's because the application must stop a test if someone presses the button to power on the laptop. So this is my main urge, almost everything else I've tested and had no luck looking at dmesg due to lack of understading.


Hope someone can clarify my doubt, thanks in advance.

Post not yet marked as solved Up vote post of xedgeos Down vote post of xedgeos
1.2k views