Post

Replies

Boosts

Views

Activity

Reply to kIOMessageDeviceWillPowerOff notification doesn't work as expected
Thank you for replying to my post, I guess I haven't give enough details.. the use case scenario is with my laptop with an external drive connected (for backups). What I want to achieve is an automatic unmount of the connected drive for either of the following events: 1/ I close the lid or 2/ the screen is turned off . Thus, when I disconnect the drive (actually the hub) I don't have to care about unmounting the external drive. In reality, there is more (not cpu intensive) tasks to be done. But That's the idea.. About your hint, I will check if it can be done.. but I guess you were thinking about an external display. In this case it makes sense that the display will disappear from the system. I don't think my laptop screen will do. What I don't understand, is that the code above (the same as sleepwatcher of Bernhard Baehr (https://www.bernhard-baehr.de/) doesn't work as expected.. I mean, the display is clearly off, still the callback is never called (whatever the message). To turn off the screen I just use a display corner shortcut set to "set monitor to sleep".
Topic: App & System Services SubTopic: Drivers Tags:
Aug ’23